From b60cfef74934fc3892e4a54941ce06cc986e1fc4 Mon Sep 17 00:00:00 2001 From: agilob Date: Sun, 15 Mar 2015 20:29:23 +0000 Subject: [PATCH 1/2] closes tux3/qtox #1399 disabling scrolling on comboboxes in all settings forms --- src/widget/form/profileform.cpp | 16 ++++++++++++++++ src/widget/form/profileform.h | 1 + src/widget/form/settings/advancedform.cpp | 16 ++++++++++++++++ src/widget/form/settings/advancedform.h | 3 +++ src/widget/form/settings/avform.cpp | 16 ++++++++++++++++ src/widget/form/settings/avform.h | 6 +++--- src/widget/form/settings/generalform.cpp | 4 ++-- 7 files changed, 57 insertions(+), 5 deletions(-) diff --git a/src/widget/form/profileform.cpp b/src/widget/form/profileform.cpp index 41d3cccd8..1b1881b4b 100644 --- a/src/widget/form/profileform.cpp +++ b/src/widget/form/profileform.cpp @@ -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() ) { + cb->installEventFilter(this); + cb->setFocusPolicy(Qt::StrongFocus); + } } ProfileForm::~ProfileForm() @@ -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(o) || qobject_cast(o) )) + { + e->ignore(); + return true; + } + return QWidget::eventFilter(o, e); +} diff --git a/src/widget/form/profileform.h b/src/widget/form/profileform.h index 830e486db..f20338b68 100644 --- a/src/widget/form/profileform.h +++ b/src/widget/form/profileform.h @@ -76,6 +76,7 @@ private slots: protected: virtual void showEvent(QShowEvent *); + bool eventFilter(QObject *o, QEvent *e); private: void refreshProfiles(); diff --git a/src/widget/form/settings/advancedform.cpp b/src/widget/form/settings/advancedform.cpp index 6a4887217..5bc73b2b9 100644 --- a/src/widget/form/settings/advancedform.cpp +++ b/src/widget/form/settings/advancedform.cpp @@ -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() ) { + cb->installEventFilter(this); + cb->setFocusPolicy(Qt::StrongFocus); + } } AdvancedForm::~AdvancedForm() @@ -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(o) || qobject_cast(o) )) + { + e->ignore(); + return true; + } + return QWidget::eventFilter(o, e); +} diff --git a/src/widget/form/settings/advancedform.h b/src/widget/form/settings/advancedform.h index 4a1fecf22..0f1a1a462 100644 --- a/src/widget/form/settings/advancedform.h +++ b/src/widget/form/settings/advancedform.h @@ -31,6 +31,9 @@ class AdvancedForm : public GenericForm public: AdvancedForm(); virtual ~AdvancedForm(); + +protected: + bool eventFilter(QObject *o, QEvent *e); private slots: void onMakeToxPortableUpdated(); diff --git a/src/widget/form/settings/avform.cpp b/src/widget/form/settings/avform.cpp index d3cefe8a7..da7258ba6 100644 --- a/src/widget/form/settings/avform.cpp +++ b/src/widget/form/settings/avform.cpp @@ -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() ) { + cb->installEventFilter(this); + cb->setFocusPolicy(Qt::StrongFocus); + } } AVForm::~AVForm() @@ -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(o) || qobject_cast(o) )) + { + e->ignore(); + return true; + } + return QWidget::eventFilter(o, e); +} diff --git a/src/widget/form/settings/avform.h b/src/widget/form/settings/avform.h index 9b3980189..a61831d0b 100644 --- a/src/widget/form/settings/avform.h +++ b/src/widget/form/settings/avform.h @@ -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; diff --git a/src/widget/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp index f0ed846c1..c1914cab7 100644 --- a/src/widget/form/settings/generalform.cpp +++ b/src/widget/form/settings/generalform.cpp @@ -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() ) { + foreach(QComboBox *cb, findChildren() ) { cb->installEventFilter(this); cb->setFocusPolicy(Qt::StrongFocus); } - Q_FOREACH(QSpinBox *sp, findChildren() ) { + foreach(QSpinBox *sp, findChildren() ) { sp->installEventFilter(this); sp->setFocusPolicy(Qt::WheelFocus); } From 209f8a19bac826ee141db4cf35ee96683e2292ac Mon Sep 17 00:00:00 2001 From: agilob Date: Mon, 16 Mar 2015 18:03:14 +0000 Subject: [PATCH 2/2] disable css interitance in setpassworddialog --- src/widget/form/settings/privacyform.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/widget/form/settings/privacyform.cpp b/src/widget/form/settings/privacyform.cpp index 1ab5c4ae7..85942ad1e 100644 --- a/src/widget/form/settings/privacyform.cpp +++ b/src/widget/form/settings/privacyform.cpp @@ -80,9 +80,9 @@ bool PrivacyForm::setChatLogsPassword() body += "\n\n" + tr("It appears you have an unused encrypted chat history; if the password matches, it will be added to your current history."); if (core->isPasswordSet(Core::ptMain)) - dialog = new SetPasswordDialog(body, tr("Use data file password", "pushbutton text"), this); + dialog = new SetPasswordDialog(body, tr("Use data file password", "pushbutton text"), 0); else - dialog = new SetPasswordDialog(body, QString(), this); + dialog = new SetPasswordDialog(body, QString(), 0); do { int r = dialog->exec(); @@ -203,9 +203,9 @@ bool PrivacyForm::setToxPassword() SetPasswordDialog* dialog; QString body = tr("Please set your new data file password."); if (core->isPasswordSet(Core::ptHistory)) - dialog = new SetPasswordDialog(body, tr("Use chat history password", "pushbutton text"), this); + dialog = new SetPasswordDialog(body, tr("Use chat history password", "pushbutton text"), 0); else - dialog = new SetPasswordDialog(body, QString(), this); + dialog = new SetPasswordDialog(body, QString(), 0); if (int r = dialog->exec()) {