mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 05:42:15 +01:00
mouse click on checkbox changes path
This commit is contained in:
parent
946e7da7f8
commit
75f3dca1ce
2 changed files with 9 additions and 0 deletions
|
|
@ -312,8 +312,12 @@ class BoolWidget(InputWidget):
|
|||
|
||||
self.setFocusProxy(self.input_field)
|
||||
|
||||
self.input_field.focused_in.connect(self._on_input_focus)
|
||||
self.input_field.stateChanged.connect(self._on_value_change)
|
||||
|
||||
def _on_input_focus(self):
|
||||
self.focused_in()
|
||||
|
||||
def _on_entity_change(self):
|
||||
if self.entity.value != self.input_field.isChecked():
|
||||
self.set_entity_value()
|
||||
|
|
|
|||
|
|
@ -459,6 +459,7 @@ class NiceCheckbox(QtWidgets.QFrame):
|
|||
stateChanged = QtCore.Signal(int)
|
||||
checked_bg_color = QtGui.QColor(69, 128, 86)
|
||||
unchecked_bg_color = QtGui.QColor(170, 80, 80)
|
||||
focused_in = QtCore.Signal()
|
||||
|
||||
def set_bg_color(self, color):
|
||||
self._bg_color = color
|
||||
|
|
@ -583,6 +584,10 @@ class NiceCheckbox(QtWidgets.QFrame):
|
|||
|
||||
self._on_checkstate_change()
|
||||
|
||||
def mousePressEvent(self, event):
|
||||
self.focused_in.emit()
|
||||
super(NiceCheckbox, self).mousePressEvent(event)
|
||||
|
||||
def mouseReleaseEvent(self, event):
|
||||
if event.button() == QtCore.Qt.LeftButton:
|
||||
self.setCheckState()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue