1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 14:45:07 +00:00

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
parent c8637e0206
commit cab9933834

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())