Browse Source

closes tux3/qtox #1399

disabling scrolling on comboboxes in all settings forms
pull/1400/head
agilob 11 years ago
parent
commit
b60cfef749
No known key found for this signature in database
GPG Key ID: 34568050DBCCB997
  1. 16
      src/widget/form/profileform.cpp
  2. 1
      src/widget/form/profileform.h
  3. 16
      src/widget/form/settings/advancedform.cpp
  4. 3
      src/widget/form/settings/advancedform.h
  5. 16
      src/widget/form/settings/avform.cpp
  6. 6
      src/widget/form/settings/avform.h
  7. 4
      src/widget/form/settings/generalform.cpp

16
src/widget/form/profileform.cpp

@ -116,6 +116,11 @@ ProfileForm::ProfileForm(QWidget *parent) : @@ -116,6 +116,11 @@ ProfileForm::ProfileForm(QWidget *parent) :
connect(core, &Core::usernameSet, this, [=](const QString& val) { bodyUI->userName->setText(val); });
connect(core, &Core::statusMessageSet, this, [=](const QString& val) { bodyUI->statusMessage->setText(val); });
foreach(QComboBox *cb, findChildren<QComboBox*>() ) {
cb->installEventFilter(this);
cb->setFocusPolicy(Qt::StrongFocus);
}
}
ProfileForm::~ProfileForm()
@ -369,3 +374,14 @@ void ProfileForm::showEvent(QShowEvent *event) @@ -369,3 +374,14 @@ void ProfileForm::showEvent(QShowEvent *event)
refreshProfiles();
QWidget::showEvent(event);
}
bool ProfileForm::eventFilter(QObject *o, QEvent *e)
{
if ((e->type() == QEvent::Wheel) &&
(qobject_cast<QComboBox*>(o) || qobject_cast<QAbstractSpinBox*>(o) ))
{
e->ignore();
return true;
}
return QWidget::eventFilter(o, e);
}

1
src/widget/form/profileform.h

@ -76,6 +76,7 @@ private slots: @@ -76,6 +76,7 @@ private slots:
protected:
virtual void showEvent(QShowEvent *);
bool eventFilter(QObject *o, QEvent *e);
private:
void refreshProfiles();

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

@ -42,6 +42,11 @@ AdvancedForm::AdvancedForm() : @@ -42,6 +42,11 @@ AdvancedForm::AdvancedForm() :
connect(bodyUI->cbMakeToxPortable, &QCheckBox::stateChanged, this, &AdvancedForm::onMakeToxPortableUpdated);
connect(bodyUI->syncTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onDbSyncTypeUpdated()));
connect(bodyUI->resetButton, SIGNAL(clicked()), this, SLOT(resetToDefault()));
foreach(QComboBox *cb, findChildren<QComboBox*>() ) {
cb->installEventFilter(this);
cb->setFocusPolicy(Qt::StrongFocus);
}
}
AdvancedForm::~AdvancedForm()
@ -67,3 +72,14 @@ void AdvancedForm::resetToDefault() @@ -67,3 +72,14 @@ void AdvancedForm::resetToDefault()
bodyUI->syncTypeComboBox->setCurrentIndex(index);
onDbSyncTypeUpdated();
}
bool AdvancedForm::eventFilter(QObject *o, QEvent *e)
{
if ((e->type() == QEvent::Wheel) &&
(qobject_cast<QComboBox*>(o) || qobject_cast<QAbstractSpinBox*>(o) ))
{
e->ignore();
return true;
}
return QWidget::eventFilter(o, e);
}

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

@ -31,6 +31,9 @@ class AdvancedForm : public GenericForm @@ -31,6 +31,9 @@ class AdvancedForm : public GenericForm
public:
AdvancedForm();
virtual ~AdvancedForm();
protected:
bool eventFilter(QObject *o, QEvent *e);
private slots:
void onMakeToxPortableUpdated();

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

@ -52,6 +52,11 @@ AVForm::AVForm() : @@ -52,6 +52,11 @@ AVForm::AVForm() :
connect(bodyUI->filterAudio, SIGNAL(toggled(bool)), this, SLOT(onFilterAudioToggled(bool)));
connect(bodyUI->rescanButton, &QPushButton::clicked, this, [=](){getAudioInDevices(); getAudioOutDevices();});
bodyUI->playbackSlider->setValue(100);
foreach(QComboBox *cb, findChildren<QComboBox*>() ) {
cb->installEventFilter(this);
cb->setFocusPolicy(Qt::StrongFocus);
}
}
AVForm::~AVForm()
@ -268,3 +273,14 @@ void AVForm::on_playbackSlider_valueChanged(int value) @@ -268,3 +273,14 @@ void AVForm::on_playbackSlider_valueChanged(int value)
{
Audio::getInstance().outputVolume = value / 100.0;
}
bool AVForm::eventFilter(QObject *o, QEvent *e)
{
if ((e->type() == QEvent::Wheel) &&
(qobject_cast<QComboBox*>(o) || qobject_cast<QAbstractSpinBox*>(o) ))
{
e->ignore();
return true;
}
return QWidget::eventFilter(o, e);
}

6
src/widget/form/settings/avform.h

@ -63,12 +63,12 @@ private slots: @@ -63,12 +63,12 @@ private slots:
virtual void showEvent(QShowEvent*);
void on_HueSlider_valueChanged(int value);
void on_BrightnessSlider_valueChanged(int value);
void on_SaturationSlider_valueChanged(int value);
void on_ContrastSlider_valueChanged(int value);
protected:
bool eventFilter(QObject *o, QEvent *e);
private:
Ui::AVSettings *bodyUI;

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

@ -156,12 +156,12 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) : @@ -156,12 +156,12 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
// 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
Q_FOREACH(QComboBox *cb, findChildren<QComboBox*>() ) {
foreach(QComboBox *cb, findChildren<QComboBox*>() ) {
cb->installEventFilter(this);
cb->setFocusPolicy(Qt::StrongFocus);
}
Q_FOREACH(QSpinBox *sp, findChildren<QSpinBox*>() ) {
foreach(QSpinBox *sp, findChildren<QSpinBox*>() ) {
sp->installEventFilter(this);
sp->setFocusPolicy(Qt::WheelFocus);
}

Loading…
Cancel
Save