mirror of
https://github.com/RGBCube/serenity
synced 2025-05-29 17:25:10 +00:00
TextEditor: Put fonts in exclusive action group
This commit is contained in:
parent
4a57cbc98f
commit
15cb4207fc
2 changed files with 10 additions and 2 deletions
|
@ -429,12 +429,18 @@ TextEditorWidget::TextEditorWidget()
|
|||
view_menu.add_action(*m_html_preview_action);
|
||||
view_menu.add_separator();
|
||||
|
||||
font_actions.set_exclusive(true);
|
||||
|
||||
auto& font_menu = view_menu.add_submenu("Font");
|
||||
GUI::FontDatabase::the().for_each_fixed_width_font([&](const StringView& font_name) {
|
||||
font_menu.add_action(GUI::Action::create(font_name, [this](const GUI::Action& action) {
|
||||
auto action = GUI::Action::create_checkable(font_name, [&](auto& action) {
|
||||
m_editor->set_font(GUI::FontDatabase::the().get_by_name(action.text()));
|
||||
m_editor->update();
|
||||
}));
|
||||
});
|
||||
if (m_editor->font().name() == font_name)
|
||||
action->set_checked(true);
|
||||
font_actions.add_action(*action);
|
||||
font_menu.add_action(*action);
|
||||
});
|
||||
|
||||
syntax_actions.set_exclusive(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue