Mercurial > octave
comparison libgui/graphics/RadioButtonControl.cc @ 28248:aee0f20c8029
Implement "gray" when uicontrol radiobutton/checkbox are disabled (bug #57128)
* BaseControl.cc (updatePalette): Call setColor() with additional argument of
"QPalette::Active" and again with "QPalette::Inactive" so that colors are set
only for specific roles.
* CheckBoxControl.h (CheckBoxControl): Declare new private member function
update().
* CheckBoxControl.cc (CheckBoxControl): Check for "Enable" property value of
"inactive" and call setCheckable (false) if found.
* CheckBoxControl.cc (update): New function to intercept and handle change to
"Enable" property before forwarding to BaseControl.
* RadioButtonControl.cc (RadioButtonControl): Check for "Enable" property value
of "inactive" and call setCheckable (false) if found.
* RadioButtonControl.cc (update): New function to intercept and handle change
to "Enable" property before forwarding to BaseControl.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 26 Apr 2020 18:15:30 -0700 |
parents | bd51beb6205e |
children | 7854d5752dd2 |
comparison
equal
deleted
inserted
replaced
28247:20794455ea11 | 28248:aee0f20c8029 |
---|---|
67 Object *parent = parentObject (interp, go); | 67 Object *parent = parentObject (interp, go); |
68 ButtonGroup *btnGroup = dynamic_cast<ButtonGroup *>(parent); | 68 ButtonGroup *btnGroup = dynamic_cast<ButtonGroup *>(parent); |
69 if (btnGroup) | 69 if (btnGroup) |
70 btnGroup->addButton (radio); | 70 btnGroup->addButton (radio); |
71 | 71 |
72 uicontrol::properties& up = properties<uicontrol> (); | |
73 | |
72 radio->setAutoFillBackground (true); | 74 radio->setAutoFillBackground (true); |
73 radio->setAutoExclusive (false); | 75 radio->setAutoExclusive (false); |
76 if (up.enable_is ("inactive")) | |
77 radio->setCheckable (false); | |
74 } | 78 } |
75 | 79 |
76 RadioButtonControl::~RadioButtonControl (void) | 80 RadioButtonControl::~RadioButtonControl (void) |
77 { } | 81 { } |
78 | 82 |
83 void | |
84 RadioButtonControl::update (int pId) | |
85 { | |
86 uicontrol::properties& up = properties<uicontrol> (); | |
87 QRadioButton *btn = qWidget<QRadioButton> (); | |
88 | |
89 switch (pId) | |
90 { | |
91 case uicontrol::properties::ID_ENABLE: | |
92 { | |
93 if (up.enable_is ("inactive")) | |
94 btn->setCheckable (false); | |
95 else | |
96 btn->setCheckable (true); | |
97 ButtonControl::update (pId); | |
98 } | |
99 break; | |
100 | |
101 default: | |
102 ButtonControl::update (pId); | |
103 break; | |
104 } | |
105 } | |
106 | |
79 }; | 107 }; |