Skip to content

Commit

Permalink
Update MultipleChoiceItem to support callback property feature
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreRaybaut committed Aug 29, 2024
1 parent a18182e commit f6e79b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog #

## Version 3.6.3 ##

In this release, test coverage is 74%.

🛠️ Bug fixes:

* MultipleChoiceItem: implemented `callback` property feature (was unexpectedly not supported)

## Version 3.6.2 ##

In this release, test coverage is 74%.
Expand Down
7 changes: 6 additions & 1 deletion guidata/dataset/qtitemwidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ def __init__(
_choices = item.get_prop_value("data", "choices")
for _k, choice, _img in _choices:
checkbox = QCheckBox(choice)
checkbox.stateChanged.connect(lambda: self.notify_value_change())
checkbox.stateChanged.connect(lambda: self.checkbox_clicked())
layout.addWidget(checkbox, cx, cy)
if nx < 0:
cy += 1
Expand Down Expand Up @@ -1214,6 +1214,11 @@ def set_state(self):
super().set_state()
self.groupbox.setEnabled(not self.is_readonly())

def checkbox_clicked(self):
"""Update the data item value when a checkbox is clicked"""
self.notify_value_change()
_display_callback(self, self.value())


class FloatArrayWidget(AbstractDataSetWidget):
"""
Expand Down

0 comments on commit f6e79b5

Please sign in to comment.