# HG changeset patch # User Olaf Wintermann <olaf.wintermann@gmail.com> # Date 1743844862 -7200 # Node ID 0e543e1d060e7efe4be5412381201cf20e207498 # Parent 0412c4c1048eda6edb0e80c8d447c38ed9b70482 handle radiobutton click event (QT) diff -r 0412c4c1048e -r 0e543e1d060e ui/qt/button.cpp --- a/ui/qt/button.cpp Fri Apr 04 22:16:29 2025 +0200 +++ b/ui/qt/button.cpp Sat Apr 05 11:21:02 2025 +0200 @@ -165,6 +165,14 @@ } +static void radiobutton_event(UiEvent *event, UiEventWrapper *wrapper) { + if(wrapper->var) { + UiInteger *value = wrapper->var->value; + event->eventdata = value; + event->intval = ui_get(value); + } +} + UIWIDGET ui_radiobutton_create(UiObject *obj, UiToggleArgs args) { UiContainerPrivate *ctn = ui_obj_container(obj); UI_APPLY_LAYOUT(ctn->layout, args); @@ -190,9 +198,12 @@ value->set = ui_radiobutton_set; } - // TODO: unbind var/remove button from buttongroup when the button is destroyed - // TODO: implement callback - // TODO: implement value observer + UiEventWrapper *event = new UiEventWrapper(obj, args.onchange, args.onchangedata); + event->var = var; + event->customdata1 = button; + event->prepare_event = togglebutton_event; + button->connect(button, SIGNAL(clicked()), event, SLOT(slot())); + button->connect(button, SIGNAL(destroyed()), event, SLOT(destroy())); ctn->add(button, false); diff -r 0412c4c1048e -r 0e543e1d060e ui/qt/toolkit.cpp --- a/ui/qt/toolkit.cpp Fri Apr 04 22:16:29 2025 +0200 +++ b/ui/qt/toolkit.cpp Sat Apr 05 11:21:02 2025 +0200 @@ -161,7 +161,7 @@ } UiAction::~UiAction() { - + // TODO: unbind var } void UiAction::trigger() {