Summary: | Use middle mouse button to scroll image | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Dan Leinir Turthra Jensen <leinir> |
Component: | Usability-Mouse | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | caulier.gilles |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 7.5.0 | |
Sentry Crash Report: |
Description
Dan Leinir Turthra Jensen
2004-08-19 20:58:13 UTC
CVS commit by pahlibar: * use middle mouse button to scroll image CCMAIL: 87539-done@bugs.kde.org M +74 -32 canvas.cpp 1.19 --- kdeextragear-3/digikam/utilities/imageeditor/canvas.cpp #1.18:1.19 @@ -75,4 +75,7 @@ public: bool lbActive; bool rbActive; + bool midButtonPressed; + int midButtonX; + int midButtonY; QTimer *paintTimer; @@ -104,4 +107,7 @@ Canvas::Canvas(QWidget *parent) d->lbActive = false; d->rbActive = false; + d->midButtonPressed = false; + d->midButtonX = 0; + d->midButtonY = 0; d->qpix = 0; @@ -423,4 +429,8 @@ void Canvas::contentsMousePressEvent(QMo return; + d->midButtonPressed = false; + + if (e->button() == Qt::LeftButton) + { if (d->ltActive || d->rtActive || d->lbActive || d->rbActive) { @@ -430,5 +440,5 @@ void Canvas::contentsMousePressEvent(QMo return; - // Set diagonally oppposite corner as anchor + // Set diagonally opposite corner as anchor QRect r(d->rubber->normalize()); @@ -452,10 +462,21 @@ void Canvas::contentsMousePressEvent(QMo viewport()->setMouseTracking(false); - //viewport()->update(); - //d->pressedMoved = false; d->pressedMoving = true; return; } + } + else if (e->button() == Qt::MidButton) + { + if (visibleWidth() < d->im->width() || + visibleHeight() < d->im->height()) + { + viewport()->setCursor(Qt::SizeAllCursor); + d->midButtonPressed = true; + d->midButtonX = e->x(); + d->midButtonY = e->y(); + } + return; + } if (d->rubber) { @@ -475,8 +496,19 @@ void Canvas::contentsMousePressEvent(QMo void Canvas::contentsMouseMoveEvent(QMouseEvent *e) { - if (!e || !d->rubber) + if (!e) return; - if (!viewport()->hasMouseTracking()) { + if (e->state() == Qt::MidButton) + { + if (d->midButtonPressed) + { + scrollBy(d->midButtonX - e->x(), + d->midButtonY - e->y()); + } + } + else if (!viewport()->hasMouseTracking()) + { + if (!d->rubber) + return; if (e->state() != Qt::LeftButton && @@ -503,4 +535,7 @@ void Canvas::contentsMouseMoveEvent(QMou else { + if (!d->rubber) + return; + QRect r(d->rubber->normalize()); @@ -541,4 +576,6 @@ void Canvas::contentsMouseReleaseEvent(Q return; + d->midButtonPressed = false; + if (d->pressedMoving) { d->pressedMoving = false; @@ -559,6 +596,11 @@ void Canvas::contentsMouseReleaseEvent(Q } - if (e->button() == Qt::RightButton) { + if (e->button() != Qt::LeftButton) + { viewport()->unsetCursor(); + } + + if (e->button() == Qt::RightButton) + { emit signalRightButtonClicked(); } |