GToolBar: Make buttons exclusive if action belongs to exclusive group

This was probably what I had originally intended when I first wrote the
GActionGroup stuff, but it seems to have been forgotten.
This commit is contained in:
Andreas Kling 2019-11-10 22:49:02 +01:00
commit cab9933834
Notes: sideshowbarker 2024-07-19 11:16:34 +09:00

View file

@ -1,4 +1,5 @@
#include <LibGUI/GAction.h>
#include <LibGUI/GActionGroup.h>
#include <LibGUI/GBoxLayout.h>
#include <LibGUI/GButton.h>
#include <LibGUI/GPainter.h>
@ -36,6 +37,8 @@ void GToolBar::add_action(GAction& action)
item->action = action;
auto button = GButton::construct(this);
if (action.group() && action.group()->is_exclusive())
button->set_exclusive(true);
button->set_action(*item->action);
button->set_tooltip(item->action->text());
if (item->action->icon())