[Kst] branches/work/kst/portto4/kst/src/libkstapp
Barth Netterfield
netterfield at astro.utoronto.ca
Wed Nov 30 00:57:08 UTC 2011
SVN commit 1266574 by netterfield:
BUG: 261972
restore 1.x scroll wheel behavior.
M +38 -0 plotrenderitem.cpp
M +1 -0 plotrenderitem.h
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.cpp #1266573:1266574
@@ -502,7 +502,45 @@
}
}
+void PlotRenderItem::wheelEvent(QGraphicsSceneWheelEvent *event) {
+ const Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers();
+ bool zoom = false;
+ if (modifiers & Qt::SHIFT) {
+ if (event->delta()>0) {
+ plotItem()->zoomYIn(true);
+ } else {
+ plotItem()->zoomYOut(true);
+ }
+ zoom = true;
+ }
+ if (modifiers & Qt::CTRL){
+ if (event->delta()>0) {
+ plotItem()->zoomXIn(true);
+ } else {
+ plotItem()->zoomXOut(true);
+ }
+ zoom = true;
+ }
+ if (zoom) {
+ return;
+ }
+
+ if ((modifiers & Qt::ALT) || zoomOnlyMode() == View::ZoomOnlyY) {
+ if (event->delta()>0) {
+ plotItem()->zoomYDown(true);
+ } else {
+ plotItem()->zoomYUp(true);
+ }
+ } else {
+ if (event->delta()>0) {
+ plotItem()->zoomXLeft(true);
+ } else {
+ plotItem()->zoomXRight(true);
+ }
+ }
+}
+
void PlotRenderItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
if (view()->viewMode() != View::Data) {
event->ignore();
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.h #1266573:1266574
@@ -86,6 +86,7 @@
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
+ virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
More information about the Kst
mailing list