Commit dd160d81 authored by Halla Rempt's avatar Halla Rempt
Browse files

Add wheelevent code to the slider/spinbox

However, this still doesn't work in the brush editor popup.

CCBUG:311241
parent 83500b9f
......@@ -49,8 +49,9 @@ public:
QSpinBox* dummySpinBox;
};
KisAbstractSliderSpinBox::KisAbstractSliderSpinBox(QWidget* parent, KisAbstractSliderSpinBoxPrivate* _d) :
QWidget(parent), d_ptr(_d)
KisAbstractSliderSpinBox::KisAbstractSliderSpinBox(QWidget* parent, KisAbstractSliderSpinBoxPrivate* _d)
: QWidget(parent)
, d_ptr(_d)
{
Q_D(KisAbstractSliderSpinBox);
d->upButtonDown = false;
......@@ -204,7 +205,7 @@ void KisAbstractSliderSpinBox::mouseMoveEvent(QMouseEvent* e)
QStyleOptionSpinBox spinOpts = spinBoxOptions();
//Respect emulated mouse grab.
if (e->buttons() & Qt::LeftButton &&
!(d->downButtonDown || d->upButtonDown)) {
!(d->downButtonDown || d->upButtonDown)) {
setInternalValue(valueForX(e->pos().x()));
update();
}
......@@ -238,6 +239,18 @@ void KisAbstractSliderSpinBox::keyPressEvent(QKeyEvent* e)
}
}
void KisAbstractSliderSpinBox::wheelEvent(QWheelEvent *e)
{
Q_D(KisAbstractSliderSpinBox);
if (e->orientation() == Qt::Horizontal) {
setInternalValue(d->value + d->singleStep);
} else {
setInternalValue(d->value - d->singleStep);
}
e->accept();
}
bool KisAbstractSliderSpinBox::eventFilter(QObject* recv, QEvent* e)
{
Q_D(KisAbstractSliderSpinBox);
......@@ -287,7 +300,7 @@ QSize KisAbstractSliderSpinBox::sizeHint() const
spinOpts.rect = rect();
return style()->sizeFromContents(QStyle::CT_SpinBox, &spinOpts, hint, 0)
.expandedTo(QApplication::globalStrut());
.expandedTo(QApplication::globalStrut());
}
......@@ -418,7 +431,7 @@ class KisSliderSpinBoxPrivate : public KisAbstractSliderSpinBoxPrivate {
KisSliderSpinBox::KisSliderSpinBox(QWidget* parent) : KisAbstractSliderSpinBox(parent, new KisSliderSpinBoxPrivate)
{
setRange(0,99);
setRange(0,99);
}
KisSliderSpinBox::~KisSliderSpinBox()
......
......@@ -59,6 +59,7 @@ protected:
virtual void mouseMoveEvent(QMouseEvent* e);
virtual void mouseDoubleClickEvent(QMouseEvent* e);
virtual void keyPressEvent(QKeyEvent* e);
virtual void wheelEvent(QWheelEvent *);
virtual bool eventFilter(QObject* recv, QEvent* e);
......
Supports Markdown
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