make wheel events work, based on a patch by afiestas

CCMAIL:alex@eyeos.org

svn path=/trunk/KDE/kdelibs/; revision=890354
This commit is contained in:
Aaron J. Seigo 2008-11-29 00:03:08 +00:00
parent 4a7699ce82
commit 807b2cf637
2 changed files with 11 additions and 2 deletions

View File

@ -19,10 +19,11 @@
#include "slider.h" #include "slider.h"
#include <QSlider> #include <QApplication>
#include <QPainter> #include <QPainter>
#include <QSlider>
#include <QStyleOptionSlider> #include <QStyleOptionSlider>
#include <QGraphicsSceneWheelEvent>
#include <kmimetype.h> #include <kmimetype.h>
#include "theme.h" #include "theme.h"
@ -125,6 +126,13 @@ void Slider::paint(QPainter *painter,
d->handle->paintFrame(painter, handleRect.topLeft()); d->handle->paintFrame(painter, handleRect.topLeft());
} }
void Slider::wheelEvent(QGraphicsSceneWheelEvent *event)
{
QWheelEvent e(event->pos().toPoint(), event->delta(),event->buttons(),event->modifiers(),event->orientation());
QApplication::sendEvent(widget(), &e);
event->accept();
}
void Slider::setMaximum(int max) void Slider::setMaximum(int max)
{ {
static_cast<QSlider*>(widget())->setMaximum(max); static_cast<QSlider*>(widget())->setMaximum(max);

View File

@ -91,6 +91,7 @@ public:
protected: protected:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void wheelEvent(QGraphicsSceneWheelEvent *event);
public Q_SLOTS: public Q_SLOTS:
/** /**