Skip to content

Commit

Permalink
Added wheelEvent() method to receive events from the mouse wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
wincentbalin committed Jul 9, 2010
1 parent cd2c987 commit 2ae9a73
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pdqt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,18 @@ void PDQt::keyReleaseEvent(QKeyEvent* k)
repaint(false);
}

/** Mouse wheel was turned. */
void PDQt::wheelEvent(QWheelEvent* w)
{
#define WHEEL_DELTA 120

// Change value of the wheel
controller->addToWheel(w->delta() / WHEEL_DELTA);

// We accept every mouse wheel event
w->accept();
}

void PDQt::resizeEvent(QResizeEvent *)
{
// Get screen dimensions
Expand Down
1 change: 1 addition & 0 deletions pdqt.h
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ namespace pdqt
protected:
void keyPressEvent(QKeyEvent*);
void keyReleaseEvent(QKeyEvent*);
void wheelEvent(QWheelEvent*);
void resizeEvent(QResizeEvent*);
void paintEvent(QPaintEvent*);
void closeEvent(QCloseEvent*);
Expand Down

0 comments on commit 2ae9a73

Please sign in to comment.