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_pressedAction( 0 )
{ {
m_outputdev = new QOutputDevPixmap(); m_outputdev = new QOutputDevPixmap();
setMouseTracking(true); setFocusPolicy( QWidget::StrongFocus );
viewport()->setFocusPolicy( QWidget::WheelFocus );
} }
PageWidget::~PageWidget() PageWidget::~PageWidget()
{ {
@ -129,6 +130,57 @@ namespace KPDF
setVScrollBarMode( b ? Auto : AlwaysOff ); 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() void PageWidget::updatePixmap()
{ {
if ( m_doc ) if ( m_doc )

View file

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