mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:28:13 +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:
parent
c8637e0206
commit
cab9933834
1 changed files with 3 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
#include <LibGUI/GAction.h>
|
#include <LibGUI/GAction.h>
|
||||||
|
#include <LibGUI/GActionGroup.h>
|
||||||
#include <LibGUI/GBoxLayout.h>
|
#include <LibGUI/GBoxLayout.h>
|
||||||
#include <LibGUI/GButton.h>
|
#include <LibGUI/GButton.h>
|
||||||
#include <LibGUI/GPainter.h>
|
#include <LibGUI/GPainter.h>
|
||||||
|
@ -36,6 +37,8 @@ void GToolBar::add_action(GAction& action)
|
||||||
item->action = action;
|
item->action = action;
|
||||||
|
|
||||||
auto button = GButton::construct(this);
|
auto button = GButton::construct(this);
|
||||||
|
if (action.group() && action.group()->is_exclusive())
|
||||||
|
button->set_exclusive(true);
|
||||||
button->set_action(*item->action);
|
button->set_action(*item->action);
|
||||||
button->set_tooltip(item->action->text());
|
button->set_tooltip(item->action->text());
|
||||||
if (item->action->icon())
|
if (item->action->icon())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue