26 #if defined (HAVE_CONFIG_H)
30 #include <QAbstractButton>
44 const graphics_object& go,
46 :
BaseControl (oct_qobj, interp, go, btn), m_blockCallback (false)
51 str.replace (
"&",
"&&");
53 if (btn->isCheckable () || up.style_is (
"togglebutton"))
55 btn->setCheckable (
true);
57 Matrix value = up.get_value ().matrix_value ();
59 if (value.
numel () > 0 && value(0) == up.get_max ())
60 btn->setChecked (
true);
74 QAbstractButton *btn = qWidget<QAbstractButton> ();
78 case uicontrol::properties::ID_STRING:
81 str.replace (
"&",
"&&");
86 case uicontrol::properties::ID_VALUE:
88 if (btn->isCheckable ())
90 Matrix value = up.get_value ().matrix_value ();
92 if (value.
numel () > 0)
94 double dValue = value(0);
96 if (dValue != 0.0 && dValue != 1.0)
97 warning (
"button value not within valid display range");
98 else if (dValue == up.get_min () && btn->isChecked ())
100 btn->setChecked (
false);
101 if (up.style_is (
"radiobutton") || up.style_is (
"togglebutton"))
111 else if (dValue == up.get_max () && ! btn->isChecked ())
112 btn->setChecked (
true);
127 QAbstractButton *btn = qWidget<QAbstractButton> ();
133 octave::autolock guard (gh_mgr.graphics_lock ());
137 Matrix oldValue = up.get_value ().matrix_value ();
138 double newValue = (checked ? up.get_max () : up.get_min ());
140 if (oldValue.
numel () != 1 || (newValue != oldValue(0)))
149 QAbstractButton *btn = qWidget<QAbstractButton> ();
151 if (! btn->isCheckable ())
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type numel(void) const
Number of elements in the array.
void gh_callback_event(const graphics_handle &h, const std::string &name)
static Object * parentObject(octave::interpreter &interp, const graphics_object &go)
void gh_set_event(const graphics_handle &h, const std::string &name, const octave_value &value)
octave::interpreter & m_interpreter
Base class for Octave interfaces that use Qt.
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void warning(const char *fmt,...)
QString fromStdString(const std::string &s)
T::properties & properties(graphics_object obj)