summaryrefslogtreecommitdiff
path: root/dgedit/canvastoolthreshold.cc
diff options
context:
space:
mode:
Diffstat (limited to 'dgedit/canvastoolthreshold.cc')
-rw-r--r--dgedit/canvastoolthreshold.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/dgedit/canvastoolthreshold.cc b/dgedit/canvastoolthreshold.cc
index d8e2dff..a321ff2 100644
--- a/dgedit/canvastoolthreshold.cc
+++ b/dgedit/canvastoolthreshold.cc
@@ -45,7 +45,9 @@ CanvasToolThreshold::CanvasToolThreshold(Canvas *c)
bool CanvasToolThreshold::mouseMoveEvent(QMouseEvent *event)
{
- if(event->button() != Qt::LeftButton) {
+ if(!isActive()) return false;
+
+ if(event->button() != Qt::LeftButton) {
if(abs(event->y() - mapY(threshold)) < 2 ||
abs(event->y() - mapY(-threshold)) < 2 ) {
canvas->setCursor(Qt::SplitVCursor);
@@ -58,6 +60,9 @@ bool CanvasToolThreshold::mouseMoveEvent(QMouseEvent *event)
if(fabs(val) > 1.0) val = 1.0;
threshold = fabs(val);
canvas->update();
+
+ emit thresholdChanging(threshold);
+
return true;
}
@@ -66,6 +71,8 @@ bool CanvasToolThreshold::mouseMoveEvent(QMouseEvent *event)
bool CanvasToolThreshold::mousePressEvent(QMouseEvent *event)
{
+ if(!isActive()) return false;
+
if(event->button() == Qt::LeftButton) {
// Check if threshold is being dragged.
@@ -82,6 +89,8 @@ bool CanvasToolThreshold::mousePressEvent(QMouseEvent *event)
bool CanvasToolThreshold::mouseReleaseEvent(QMouseEvent *event)
{
+ if(!isActive()) return false;
+
if(event->button() == Qt::LeftButton) {
if(threshold_is_moving) {
threshold_is_moving = false;
@@ -99,6 +108,8 @@ bool CanvasToolThreshold::mouseReleaseEvent(QMouseEvent *event)
void CanvasToolThreshold::paintEvent(QPaintEvent *event, QPainter &painter)
{
+ if(!isActive()) return;
+
if(threshold_is_moving) painter.setPen(colThresholdMoving);
else painter.setPen(colThreshold);
painter.drawLine(event->rect().x(), mapY(threshold),