Commit db5522e1 authored by Laurent Montel's avatar Laurent Montel 😁

Now we can move page with mouse

svn path=/trunk/kdegraphics/kpdf/; revision=251251
parent 7178b231
......@@ -46,7 +46,12 @@ namespace KPDF
{
if (m_doc == 0)
return;
if ( e->button() & RightButton )
if ( e->button() & LeftButton )
{
m_dragGrabPos = e -> globalPos();
setCursor( sizeAllCursor );
}
else if ( e->button() & RightButton )
{
emit rightClick();
}
......@@ -60,22 +65,37 @@ namespace KPDF
if (m_doc == 0)
return;
if ( e -> button() & LeftButton )
{
setCursor( arrowCursor );
}
else
{
LinkAction* action = m_doc->findLink(e->x()/m_ppp, e->y()/m_ppp);
if (action == m_pressedAction)
emit linkClicked(action);
m_pressedAction = 0;
}
}
void
PageWidget::contentsMouseMoveEvent(QMouseEvent* e)
{
if (m_doc == 0)
return;
if ( e->state() & LeftButton )
{
QPoint delta = m_dragGrabPos - e->globalPos();
scrollBy( delta.x(), delta.y() );
m_dragGrabPos = e->globalPos();
}
else
{
LinkAction* action = m_doc->findLink(e->x()/m_ppp, e->y()/m_ppp);
setCursor(action != 0 ? Qt::PointingHandCursor : Qt::ArrowCursor);
}
}
void PageWidget::drawContents ( QPainter *p, int clipx, int clipy, int clipw, int cliph )
{
......
......@@ -79,7 +79,7 @@ namespace KPDF
ZoomMode m_zoomMode;
int m_currentPage;
QPoint m_dragGrabPos;
LinkAction* m_pressedAction;
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment