mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
creasted spin boxes that allow mouse scroll changes only on active widgets
This commit is contained in:
parent
7afbd4b9de
commit
f6ee5db227
2 changed files with 32 additions and 0 deletions
|
|
@ -1,4 +1,6 @@
|
|||
from .widgets import (
|
||||
FocusSpinBox,
|
||||
FocusDoubleSpinBox,
|
||||
CustomTextComboBox,
|
||||
PlaceholderLineEdit,
|
||||
BaseClickableFrame,
|
||||
|
|
@ -34,6 +36,8 @@ from .overlay_messages import (
|
|||
|
||||
|
||||
__all__ = (
|
||||
"FocusSpinBox",
|
||||
"FocusDoubleSpinBox",
|
||||
"CustomTextComboBox",
|
||||
"PlaceholderLineEdit",
|
||||
"BaseClickableFrame",
|
||||
|
|
|
|||
|
|
@ -13,6 +13,34 @@ from openpype.lib.attribute_definitions import AbstractAttrDef
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class FocusSpinBox(QtWidgets.QSpinBox):
|
||||
"""QSpinBox which allow scroll wheel changes only in active state."""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(FocusSpinBox, self).__init__(*args, **kwargs)
|
||||
self.setFocusPolicy(QtCore.Qt.StrongFocus)
|
||||
|
||||
def wheelEvent(self, event):
|
||||
if not self.hasFocus():
|
||||
event.ignore()
|
||||
else:
|
||||
super(FocusSpinBox, self).wheelEvent(event)
|
||||
|
||||
|
||||
class FocusDoubleSpinBox(QtWidgets.QDoubleSpinBox):
|
||||
"""QDoubleSpinBox which allow scroll wheel changes only in active state."""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(FocusDoubleSpinBox, self).__init__(*args, **kwargs)
|
||||
self.setFocusPolicy(QtCore.Qt.StrongFocus)
|
||||
|
||||
def wheelEvent(self, event):
|
||||
if not self.hasFocus():
|
||||
event.ignore()
|
||||
else:
|
||||
super(FocusDoubleSpinBox, self).wheelEvent(event)
|
||||
|
||||
|
||||
class CustomTextComboBox(QtWidgets.QComboBox):
|
||||
"""Combobox which can have different text showed."""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue