Use key to move page

svn path=/trunk/kdegraphics/kpdf/; revision=251097
This commit is contained in:
Laurent Montel 2003-09-14 21:26:04 +00:00
parent cf2a93f418
commit 5e89aedf16
2 changed files with 60 additions and 2 deletions

View file

@ -21,7 +21,8 @@ namespace KPDF
m_pressedAction( 0 )
{
m_outputdev = new QOutputDevPixmap();
setMouseTracking(true);
setFocusPolicy( QWidget::StrongFocus );
viewport()->setFocusPolicy( QWidget::WheelFocus );
}
PageWidget::~PageWidget()
{
@ -129,6 +130,57 @@ namespace KPDF
setVScrollBarMode( b ? Auto : AlwaysOff );
}
void PageWidget::scrollRight()
{
horizontalScrollBar()->addLine();
}
void PageWidget::scrollLeft()
{
horizontalScrollBar()->subtractLine();
}
void PageWidget::scrollDown()
{
verticalScrollBar()->addLine();
}
void PageWidget::scrollUp()
{
verticalScrollBar()->subtractLine();
}
void PageWidget::scrollBottom()
{
verticalScrollBar()->setValue( verticalScrollBar()->maxValue() );
}
void PageWidget::scrollTop()
{
verticalScrollBar()->setValue( verticalScrollBar()->minValue() );
}
void PageWidget::keyPressEvent( QKeyEvent* e )
{
switch ( e->key() ) {
case Key_Up:
scrollUp();
break;
case Key_Down:
scrollDown();
break;
case Key_Left:
scrollLeft();
break;
case Key_Right:
scrollRight();
break;
default:
e->ignore();
return;
}
e->accept();
}
void PageWidget::updatePixmap()
{
if ( m_doc )

View file

@ -38,11 +38,17 @@ namespace KPDF
void zoomOut();
void updatePixmap();
void scrollUp();
void scrollDown();
void scrollRight();
void scrollLeft();
void scrollBottom();
void scrollTop();
signals:
void linkClicked(LinkAction*);
protected:
virtual void keyPressEvent( QKeyEvent* );
void contentsMousePressEvent(QMouseEvent*);
void contentsMouseReleaseEvent(QMouseEvent*);
void contentsMouseMoveEvent(QMouseEvent*);