summaryrefslogtreecommitdiff
path: root/src/samplesorter.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2018-10-29 18:41:36 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2018-10-29 18:41:36 +0100
commitfc7232eb2edb34320b6780e2d347dd03adbce4e7 (patch)
treea71e0fd0e1a76f7edcbc51ef611e3e8da019abbe /src/samplesorter.cc
parent452f4b2815e685789ef921152b01d02168c2117d (diff)
Make delete key delete selection also if sample sorter is active.
Diffstat (limited to 'src/samplesorter.cc')
-rw-r--r--src/samplesorter.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/samplesorter.cc b/src/samplesorter.cc
index 91bc6b4..29c24e6 100644
--- a/src/samplesorter.cc
+++ b/src/samplesorter.cc
@@ -28,6 +28,7 @@
#include <QPainter>
#include <QPaintEvent>
+#include <QKeyEvent>
#include <stdio.h>
@@ -42,7 +43,7 @@ SampleSorter::SampleSorter(Selections& s, Selections& p, Instrument& instrument)
, instrument(instrument)
{
setMouseTracking(true);
-
+ setFocusPolicy(Qt::ClickFocus); // Enable keyboard event on click
data = NULL;
size = 0;
attlen = 666; // Magical constants needs biblical proportions...
@@ -329,3 +330,11 @@ void SampleSorter::mouseReleaseEvent(QMouseEvent* event)
}
}
}
+
+void SampleSorter::keyReleaseEvent(QKeyEvent* event)
+{
+ if(selections.active() != SEL_NONE && event->key() == Qt::Key_Delete)
+ {
+ selections.remove(selections.active());
+ }
+}