This repository has been archived by the owner on Feb 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(settings): Added reset settings button
- Loading branch information
Showing
14 changed files
with
99 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "genericsettings.h" | ||
|
||
#include <QEvent> | ||
#include <QCheckBox> | ||
#include <QComboBox> | ||
#include <QSpinBox> | ||
|
||
GenericForm::GenericForm(const QPixmap &icon) | ||
: formIcon(icon) | ||
{ | ||
} | ||
|
||
QPixmap GenericForm::getFormIcon() | ||
{ | ||
return formIcon; | ||
} | ||
|
||
void GenericForm::eventsInit() | ||
{ | ||
// 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 changing theme/skin/icons etc. | ||
// @see GenericForm::eventFilter(QObject *o, QEvent *e) at the bottom of this file for more | ||
for (QComboBox *cb : findChildren<QComboBox*>()) | ||
{ | ||
cb->installEventFilter(this); | ||
cb->setFocusPolicy(Qt::StrongFocus); | ||
} | ||
|
||
for (QSpinBox *sp : findChildren<QSpinBox*>()) | ||
{ | ||
sp->installEventFilter(this); | ||
sp->setFocusPolicy(Qt::WheelFocus); | ||
} | ||
|
||
for (QCheckBox *cb : findChildren<QCheckBox*>()) // this one is to allow scrolling on checkboxes | ||
cb->installEventFilter(this); | ||
} | ||
|
||
bool GenericForm::eventFilter(QObject *o, QEvent *e) | ||
{ | ||
if ((e->type() == QEvent::Wheel) && | ||
(qobject_cast<QComboBox*>(o) || | ||
qobject_cast<QAbstractSpinBox*>(o) || | ||
qobject_cast<QCheckBox*>(o))) | ||
{ | ||
e->ignore(); | ||
return true; | ||
} | ||
return QWidget::eventFilter(o, e); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters