diff libgui/graphics/ButtonControl.cc @ 21824:6780a8657be3

Implement uibuttongroup (bug #47513) * doc/interpreter/genpropdoc.m: Wire in uibuttongroup documentation creation * doc/interpreter/gui.txi: Add documentation node for uibuttongroup * doc/interpreter/module.mk: Wire in uibuttongroup documentation creation * doc/interpreter/plot.txi: Add documentation node for uibuttongroup * libgui/graphics/__init_qt__.cc (__init__): Set default styling for uibuttongroup * libgui/graphics/Backend.cc (toolkitObjectProperty): Add uibuttongroup * libgui/graphics/Backend.cc (Backend::initialize): Add uibuttongroup * libgui/graphics/Backend.cc (Backend::update): Add uibuttongroup * libgui/graphics/ButtonControl.cc (ButtonControl::update): Catch forced uncheck of selected button in buttongroup * libgui/graphics/Canvas.cc (Canvas::select_object): Allow uibuttongroup to be selected like uicontrol or uipanel * libgui/graphics/Figure.cc (hasUiControlChildren): Ensure that uibuttongroup is known to have children * libgui/graphics/module.mk: Wire in ButtonGroup * libgui/graphics/ObjectFactory.cc (ObjectFactory::createObject): Create ButtonGroup for uibuttongroup * libgui/graphics/QtHandlesUtils.cc (computeFont<uibuttongroup>): Make computeFont template for uibuttongroup * libgui/graphics/RadioButtonControl.cc (RadioButtonControl::RadioButtonControl): On creation of button add to ButtonGroup * libgui/graphics/ToggleButtonControl.cc (ToggleButtonControl::ToggleButtonControl): On creation of button add to ButtonGroup * libinterp/corefcn/gl-render.cc (opengl_renderer::draw): Allow uibuttongroup to be drawn * libinterp/corefcn/gl-render.cc (opengl_renderer::draw_uibuttongroup): Method to draw uibuttongroup * libinterp/corefcn/gl-render.h (opengl_renderer::draw_uibuttongroup): Method to draw uibuttongroup * libinterp/corefcn/graphics.cc (lookup_object_name): Wire in uibuttongroup * libinterp/corefcn/graphics.cc (make_graphics_object_from_type): Wire in uibuttongroup * libinterp/corefcn/graphics.cc (property_list::set): Wire in uibuttongroup * libinterp/corefcn/graphics.cc (property_list::lookup): Wire in uibuttongroup * libinterp/corefcn/graphics.cc (uibuttongroup::properties::get_boundingbox uibuttongroup::properties::set_units uibuttongroup::properties::update_units uibuttongroup::properties::set_fontunits uibuttongroup::properties::update_fontunits uibuttongroup::properties::get_fontsize_points uibuttongroup::properties::set_selectedobject): Add property methods for uibuttongroup * libinterp/corefcn/graphics.in.h: Add uibuttongroup * scripts/gui/module.mk: Wire in uibuttongroup script * scripts/help/__unimplemented__.m: Remove uibuttongroup from unimplemented * libgui/graphics/ButtonGroup.cc: Add QT toolkit ButtonGroup object * libgui/graphics/ButtonGroup.h: Add QT toolkit ButtonGroup object * scripts/gui/uibuttongroup.m: Create uibuttongroup script
author Andrew Thornton <art27@cantab.net>
date Thu, 05 May 2016 20:03:26 +0100
parents aba2e6293dd8
children f500cde065f7
line wrap: on
line diff
--- a/libgui/graphics/ButtonControl.cc	Fri Jun 03 20:56:33 2016 -0700
+++ b/libgui/graphics/ButtonControl.cc	Thu May 05 20:03:26 2016 +0100
@@ -27,6 +27,7 @@
 #include <QAbstractButton>
 
 #include "ButtonControl.h"
+#include "ButtonGroup.h"
 #include "Container.h"
 #include "QtHandlesUtils.h"
 
@@ -82,7 +83,16 @@
               if (dValue != 0.0 && dValue != 1.0)
                 warning ("button value not within valid display range");
               else if (dValue == up.get_min () && btn->isChecked ())
-                btn->setChecked (false);
+                {
+                  btn->setChecked (false);
+                  if (up.style_is ("radiobutton") || up.style_is ("togglebutton"))
+                    {
+                      Object* parent = Object::parentObject (gh_manager::get_object (up.get___myhandle__ ()));
+                      ButtonGroup* btnGroup = dynamic_cast<ButtonGroup*>(parent);
+                      if (btnGroup)
+                        btnGroup->selectNothing ();
+                    }
+                }
               else if (dValue == up.get_max () && ! btn->isChecked ())
                 btn->setChecked (true);
             }