Commit d86df01e authored by Dmitry Kazakov's avatar Dmitry Kazakov

Let changing the onion skins sliders by Shift+dragging over the widget

Just press Shift and drag over the sliders and they'll be ordered accordingly.
If you also press Ctrl or right mouse button, the sliders will move smoothly.

This feature doesn't work for the top buttons, but if you want to disable
some skins, just drag over the bottom part of the widget and when the sliders
reach 0 level, the buttons will be disabled automatically

Fixes:T1043
parent aa1e603c
......@@ -112,6 +112,13 @@ void KisEqualizerSlider::mousePressEvent(QMouseEvent *ev)
void KisEqualizerSlider::mouseMoveEvent(QMouseEvent *ev)
{
if (ev->modifiers() & Qt::ShiftModifier &&
!rect().contains(ev->pos())) {
ev->ignore();
return;
}
const bool precise = ev->modifiers() & Qt::ControlModifier ||
ev->buttons() & Qt::RightButton;
......
......@@ -18,6 +18,8 @@
#include "kis_equalizer_widget.h"
#include <QMouseEvent>
#include <QApplication>
#include <QHBoxLayout>
#include "kis_equalizer_column.h"
......@@ -116,3 +118,21 @@ void KisEqualizerWidget::resizeEvent(QResizeEvent *event)
}
}
void KisEqualizerWidget::mouseMoveEvent(QMouseEvent *ev)
{
if (!(ev->modifiers() & Qt::ShiftModifier)) return;
QPoint globalPos = ev->globalPos();
QWidget *w = qApp->widgetAt(globalPos);
if (w && w->inherits("QAbstractSlider")) {
QMouseEvent newEv(ev->type(),
w->mapFromGlobal(globalPos),
globalPos,
ev->button(),
ev->buttons(),
ev->modifiers() & ~Qt::ShiftModifier);
qApp->sendEvent(w, &newEv);
}
}
......@@ -46,6 +46,8 @@ public:
void resizeEvent(QResizeEvent *event);
void mouseMoveEvent(QMouseEvent *ev);
Q_SIGNALS:
void sigConfigChanged();
......
Markdown is supported
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