[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdeplayground-edu/kdissert/src/kdissert/canvasview
From: Thomas Nagy <tnagyemail-mail () yahoo ! fr>
Date: 2005-05-02 3:00:43
Message-ID: 20050502030043.248F64A6 () office ! kde ! org
[Download RAW message or body]
CVS commit by tnagy:
Fixed the scroll motion for zoom values inferior to 100%
M +17 -5 DCanvasView.cpp 1.5
M +7 -1 DCanvasView.h 1.3
--- kdeplayground-edu/kdissert/src/kdissert/canvasview/DCanvasView.cpp #1.4:1.5
@@ -384,4 +384,5 @@ void DCanvasView::contentsMousePressEven
}
}
+ me->ignore();
}
@@ -512,9 +513,6 @@ void DCanvasView::contentsMouseMoveEvent
}
- // in scroll mode .. well, scroll :)
- if (m_currentAction == act_scroll)
- {
- scrollBy( m_moveStart.x() - p.x(), m_moveStart.y() - p.y() );
- }
+ // scrolling is done in mouseMoveEvent instead due to a loss of accuracy
+ me->ignore();
}
@@ -613,4 +611,18 @@ void DCanvasView::contentsMouseReleaseEv
}
+void DCanvasView::mousePressEvent(QMouseEvent* me)
+{
+ m_scrollStart = me->pos() + QPoint( contentsX(), contentsY() );
+}
+
+void DCanvasView::mouseMoveEvent(QMouseEvent* me)
+{
+ if (m_currentAction == act_scroll)
+ {
+ QPoint newpoint = m_scrollStart - me->pos();
+ setContentsPos( newpoint.x(), newpoint.y() );
+ }
+}
+
void DCanvasView::contentsWheelEvent( QWheelEvent* e )
{
--- kdeplayground-edu/kdissert/src/kdissert/canvasview/DCanvasView.h #1.2:1.3
@@ -113,4 +113,8 @@ class DCanvasView : public QCanvasView,
void keyReleaseEvent( QKeyEvent* );
+ // used for scrolling
+ void mousePressEvent(QMouseEvent*);
+ void mouseMoveEvent(QMouseEvent*);
+
void drawContents( QPainter*, int, int, int, int);
void dragEnterEvent(QDragEnterEvent *event);
@@ -140,4 +144,6 @@ class DCanvasView : public QCanvasView,
QPoint m_moveStart;
+ /// start of a scroll drag (more accurate)
+ QPoint m_scrollStart;
/// popup menu for item properties
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic