Commit f1b07a7d authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix mouse wheel changing render edit preset while scrolling

parent 5aa2c2b3
Pipeline #193480 passed with stage
in 6 minutes and 31 seconds
......@@ -14,6 +14,7 @@
#include <KMessageBox>
#include <QPushButton>
#include <QScrollBar>
// TODO replace this by std::gcd ones why require C++17 or greater
static int gcd(int a, int b)
......@@ -433,6 +434,16 @@ RenderPresetDialog::RenderPresetDialog(QWidget *parent, RenderPresetModel *prese
linkResoultion->setChecked(true);
slotUpdateParams();
Q_FOREACH (QSpinBox *sp, findChildren<QSpinBox *>()) {
sp->installEventFilter(this);
sp->setFocusPolicy(Qt::StrongFocus);
}
Q_FOREACH (QComboBox *sp, findChildren<QComboBox *>()) {
sp->installEventFilter(this);
sp->setFocusPolicy(Qt::StrongFocus);
}
// TODO
if (false && m_monitor == nullptr) {
// QString profile = DvdWizardVob::getDvdProfile(format);
......@@ -455,6 +466,20 @@ RenderPresetDialog::~RenderPresetDialog()
}
}
bool RenderPresetDialog::eventFilter(QObject *o, QEvent *e)
{
if (e->type() == QEvent::Wheel && (qobject_cast<QComboBox *>(o) || qobject_cast<QAbstractSpinBox *>(o))) {
if (scrollArea->verticalScrollBar()->isVisible() && !qobject_cast<QWidget *>(o)->hasFocus()) {
e->ignore();
return true;
} else {
e->accept();
return false;
}
}
return QWidget::eventFilter(o, e);
}
void RenderPresetDialog::slotUpdateParams()
{
QStringList params;
......
......@@ -25,6 +25,9 @@ public:
~RenderPresetDialog();
QString saveName();
protected:
bool eventFilter(QObject *o, QEvent *e) override;
private:
QString m_saveName;
QStringList m_uiParams;
......
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