Commit 32ad1cf9 authored by Ludovic Fauvet's avatar Ludovic Fauvet

Beginning of item deletion

parent 6c6d03ea
...@@ -24,12 +24,13 @@ ...@@ -24,12 +24,13 @@
#define TIMELINE_H #define TIMELINE_H
#include "ui_Timeline.h" #include "ui_Timeline.h"
#include "TracksView.h"
#include "TracksScene.h"
#include "TracksRuler.h" #include "TracksRuler.h"
#include "Workflow/MainWorkflow.h" #include "Workflow/MainWorkflow.h"
#include "Workflow/TrackWorkflow.h" #include "Workflow/TrackWorkflow.h"
class TracksScene;
class TracksView;
class Timeline : public QWidget class Timeline : public QWidget
{ {
Q_OBJECT Q_OBJECT
......
...@@ -25,3 +25,36 @@ ...@@ -25,3 +25,36 @@
TracksScene::TracksScene( QObject* parent ) : QGraphicsScene( parent ) TracksScene::TracksScene( QObject* parent ) : QGraphicsScene( parent )
{ {
} }
void TracksScene::keyPressEvent( QKeyEvent* keyEvent )
{
TracksView* tv = Timeline::getInstance()->tracksView();
if ( !tv ) return;
if ( keyEvent->modifiers() == Qt::NoModifier &&
keyEvent->key() == Qt::Key_Delete &&
selectedItems().size() >= 1 )
{
// Items deletion
keyEvent->accept();
QString message;
if ( selectedItems().size() == 1 )
message = tr("Confirm the deletion of the region ?");
else
message = tr("Confirm the deletion of those regions ?");
QMessageBox::StandardButton b =
QMessageBox::warning( tv, "Object deletion",
message,
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No );
// Skip the deletion process
if ( b == QMessageBox::No ) return;
//TODO delete the item(s)
}
QGraphicsScene::keyPressEvent( keyEvent );
}
...@@ -24,6 +24,10 @@ ...@@ -24,6 +24,10 @@
#define TRACKSSCENE_H #define TRACKSSCENE_H
#include <QGraphicsScene> #include <QGraphicsScene>
#include <QMessageBox>
#include "Timeline.h"
class TracksView;
class TracksScene : public QGraphicsScene class TracksScene : public QGraphicsScene
{ {
...@@ -31,6 +35,10 @@ class TracksScene : public QGraphicsScene ...@@ -31,6 +35,10 @@ class TracksScene : public QGraphicsScene
public: public:
TracksScene( QObject* parent = 0 ); TracksScene( QObject* parent = 0 );
virtual ~TracksScene() { }
protected:
virtual void keyPressEvent( QKeyEvent* keyevent );
}; };
#endif // TRACKSSCENE_H #endif // TRACKSSCENE_H
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