summaryrefslogtreecommitdiff
path: root/dgedit/canvastoolthreshold.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2014-04-17 09:25:03 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2014-04-17 09:25:03 +0200
commit4daa3f6dac734ae9277159a1ae895006819887e5 (patch)
tree2915e6cba967aff8cf908693f2e6179934d551b7 /dgedit/canvastoolthreshold.cc
parent02119553f51d418ebb6473f49784487fa954b50c (diff)
Make threshold slider generate new selections while moving. Add progressbar to export.
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),