Commit 7cacfcb6 authored by Ludovic Fauvet's avatar Ludovic Fauvet
Browse files

Add mouse drop action into the timeline

parent d4a47bf9
......@@ -36,6 +36,7 @@ TracksView::TracksView( QGraphicsScene* scene, QWidget* parent )
setMouseTracking( true );
setAcceptDrops( true );
setDragMode( QGraphicsView::ScrollHandDrag );
setContentsMargins( 0, 0, 0, 0 );
// Adjust the height using the number of tracks
......@@ -47,6 +48,23 @@ TracksView::TracksView( QGraphicsScene* scene, QWidget* parent )
m_cursorLine->setZValue(100);
}
void TracksView::dragEnterEvent( QDragEnterEvent* event )
{
if ( event->mimeData()->hasFormat( "vlmc/uuid" ) )
event->acceptProposedAction();
}
void TracksView::dropEvent( QDropEvent* event )
{
event->acceptProposedAction();
}
void TracksView::dragMoveEvent( QDragMoveEvent* event )
{
}
void TracksView::setDuration( int duration )
{
int diff = qAbs( duration - sceneRect().width() );
......
......@@ -23,8 +23,12 @@
#ifndef TRACKSVIEW_H
#define TRACKSVIEW_H
#include <QWidget>
#include <QGraphicsView>
#include <QGraphicsLineItem>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QDragMoveEvent>
class TracksView : public QGraphicsView
{
......@@ -41,6 +45,9 @@ protected:
virtual void drawBackground( QPainter* painter, const QRectF& rect );
virtual void mouseMoveEvent( QMouseEvent* event );
virtual void mousePressEvent( QMouseEvent* event );
virtual void dragEnterEvent( QDragEnterEvent* event );
virtual void dropEvent( QDropEvent* event );
virtual void dragMoveEvent( QDragMoveEvent* event );
private:
QGraphicsScene* m_scene;
......
......@@ -16,6 +16,9 @@
<height>150</height>
</size>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
......
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