- installed an eventFilter for the Sliders in the Preferences tab such that only if a slider has focus the mouse wheel will change its value

- in Preferences made sure that the changes of the scrollbar no longer interfere with signalling changes
This commit is contained in:
Marius Stanciu
2022-03-12 18:16:15 +02:00
committed by Marius
parent 37e31b0159
commit dc11f1be50
4 changed files with 16 additions and 2 deletions

View File

@@ -1075,6 +1075,7 @@ class FCSliderWithSpinner(QtWidgets.QFrame):
self.spinner.valueChanged.connect(self._on_spinner)
self.valueChanged = self.spinner.valueChanged
self.slider.installEventFilter(self)
def get_value(self) -> int:
return self.spinner.get_value()
@@ -1090,6 +1091,12 @@ class FCSliderWithSpinner(QtWidgets.QFrame):
slider_value = self.slider.value()
self.spinner.set_value(slider_value)
def eventFilter(self, object, event):
if event.type() == QtCore.QEvent.Type.Wheel:
if not self.slider.hasFocus():
return True
return False
class FCSpinner(QtWidgets.QSpinBox):
returnPressed = QtCore.pyqtSignal()

View File

@@ -14,7 +14,7 @@ if '_' not in builtins.__dict__:
_ = gettext.gettext
class PreferencesUIManager:
class PreferencesUIManager(QtCore.QObject):
def __init__(self, defaults: AppDefaults, data_path: str, ui, inform, options):
"""
@@ -26,6 +26,7 @@ class PreferencesUIManager:
:param inform: a pyqtSignal used to display information's in the StatusBar of the GUI
:param options: a dict holding the current defaults loaded in the application
"""
super(PreferencesUIManager, self).__init__()
self.defaults = defaults
self.data_path = data_path
@@ -1239,6 +1240,9 @@ class PreferencesUIManager:
Will color the Preferences tab text to Red color.
:return:
"""
if isinstance(self.sender(), QtWidgets.QScrollBar):
return
if self.preferences_changed_flag is False:
self.inform.emit('[WARNING_NOTCL] %s' % _("Preferences edited but not saved."))