Browse Source

Merge branch 'pr2538'

pull/2543/head
tux3 10 years ago
parent
commit
d6c042b35e
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
  1. 11
      src/widget/form/settings/advancedform.cpp
  2. 2
      src/widget/form/settings/advancedform.h
  3. 27
      src/widget/form/settings/avform.cpp
  4. 21
      src/widget/form/settings/generalform.cpp
  5. 2
      src/widget/form/settings/generalform.h

11
src/widget/form/settings/advancedform.cpp

@ -49,8 +49,13 @@ AdvancedForm::AdvancedForm() : @@ -49,8 +49,13 @@ AdvancedForm::AdvancedForm() :
for (QComboBox* cb : findChildren<QComboBox*>())
{
cb->installEventFilter(this);
cb->setFocusPolicy(Qt::StrongFocus);
cb->installEventFilter(this);
cb->setFocusPolicy(Qt::StrongFocus);
}
for (QCheckBox *cb : findChildren<QCheckBox*>()) // this one is to allow scrolling on checkboxes
{
cb->installEventFilter(this);
}
Translator::registerHandler(std::bind(&AdvancedForm::retranslateUi, this), this);
@ -84,7 +89,7 @@ void AdvancedForm::resetToDefault() @@ -84,7 +89,7 @@ void AdvancedForm::resetToDefault()
bool AdvancedForm::eventFilter(QObject *o, QEvent *e)
{
if ((e->type() == QEvent::Wheel) &&
(qobject_cast<QComboBox*>(o) || qobject_cast<QAbstractSpinBox*>(o) ))
(qobject_cast<QComboBox*>(o) || qobject_cast<QAbstractSpinBox*>(o) || qobject_cast<QCheckBox*>(o)))
{
e->ignore();
return true;

2
src/widget/form/settings/advancedform.h

@ -37,7 +37,7 @@ public: @@ -37,7 +37,7 @@ public:
virtual QString getFormName() final override {return tr("Advanced");}
protected:
bool eventFilter(QObject *o, QEvent *e) override;
bool eventFilter(QObject *o, QEvent *e) final override;
private slots:
void onMakeToxPortableUpdated();

27
src/widget/form/settings/avform.cpp

@ -78,6 +78,11 @@ AVForm::AVForm() : @@ -78,6 +78,11 @@ AVForm::AVForm() :
cb->setFocusPolicy(Qt::StrongFocus);
}
for (QCheckBox *cb : findChildren<QCheckBox*>()) // this one is to allow scrolling on checkboxes
{
cb->installEventFilter(this);
}
Translator::registerHandler(std::bind(&AVForm::retranslateUi, this), this);
}
@ -361,17 +366,6 @@ void AVForm::onMicrophoneValueChanged(int value) @@ -361,17 +366,6 @@ void AVForm::onMicrophoneValueChanged(int value)
bodyUI->microphoneMax->setText(QString::number(value));
}
bool AVForm::eventFilter(QObject *o, QEvent *e)
{
if ((e->type() == QEvent::Wheel) &&
(qobject_cast<QComboBox*>(o) || qobject_cast<QAbstractSpinBox*>(o) || qobject_cast<QSlider*>(o)))
{
e->ignore();
return true;
}
return QWidget::eventFilter(o, e);
}
void AVForm::createVideoSurface()
{
if (camVideoSurface)
@ -396,6 +390,17 @@ void AVForm::killVideoSurface() @@ -396,6 +390,17 @@ void AVForm::killVideoSurface()
camVideoSurface = nullptr;
}
bool AVForm::eventFilter(QObject *o, QEvent *e)
{
if ((e->type() == QEvent::Wheel) &&
(qobject_cast<QComboBox*>(o) || qobject_cast<QAbstractSpinBox*>(o) || qobject_cast<QCheckBox*>(o) || qobject_cast<QSlider*>(o)))
{
e->ignore();
return true;
}
return QWidget::eventFilter(o, e);
}
void AVForm::retranslateUi()
{
bodyUI->retranslateUi(this);

21
src/widget/form/settings/generalform.cpp

@ -226,20 +226,25 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) : @@ -226,20 +226,25 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
connect(bodyUI->cbDontGroupWindows, &QCheckBox::stateChanged, this, &GeneralForm::onDontGroupWindowsChanged);
connect(bodyUI->cbGroupchatPosition, &QCheckBox::stateChanged, this, &GeneralForm::onGroupchatPositionChanged);
// prevent stealing mouse whell scroll
// prevent stealing mouse wheel scroll
// scrolling event won't be transmitted to comboboxes or qspinboxes when scrolling
// you can scroll through general settings without accidentially chaning theme/skin/icons etc.
// @see GeneralForm::eventFilter(QObject *o, QEvent *e) at the bottom of this file for more
for (QComboBox* cb : findChildren<QComboBox*>())
for (QComboBox *cb : findChildren<QComboBox*>())
{
cb->installEventFilter(this);
cb->setFocusPolicy(Qt::StrongFocus);
cb->installEventFilter(this);
cb->setFocusPolicy(Qt::StrongFocus);
}
for (QSpinBox* sp : findChildren<QSpinBox*>())
for (QSpinBox *sp : findChildren<QSpinBox*>())
{
sp->installEventFilter(this);
sp->setFocusPolicy(Qt::WheelFocus);
sp->installEventFilter(this);
sp->setFocusPolicy(Qt::WheelFocus);
}
for (QCheckBox *cb : findChildren<QCheckBox*>()) // this one is to allow scrolling on checkboxes
{
cb->installEventFilter(this);
}
#ifndef QTOX_PLATFORM_EXT
@ -508,7 +513,7 @@ void GeneralForm::onThemeColorChanged(int) @@ -508,7 +513,7 @@ void GeneralForm::onThemeColorChanged(int)
bool GeneralForm::eventFilter(QObject *o, QEvent *e)
{
if ((e->type() == QEvent::Wheel) &&
(qobject_cast<QComboBox*>(o) || qobject_cast<QAbstractSpinBox*>(o) ))
(qobject_cast<QComboBox*>(o) || qobject_cast<QAbstractSpinBox*>(o) || qobject_cast<QCheckBox*>(o)))
{
e->ignore();
return true;

2
src/widget/form/settings/generalform.h

@ -81,7 +81,7 @@ private: @@ -81,7 +81,7 @@ private:
SettingsWidget *parent;
protected:
bool eventFilter(QObject *o, QEvent *e) override;
bool eventFilter(QObject *o, QEvent *e) final override;
};
#endif

Loading…
Cancel
Save