mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +00:00
Calendar: Promote view_type ActionGroup to CalendarWidget's member
Otherwise, it would get destroyed after exiting the create() function.
This commit is contained in:
parent
bb23ee3521
commit
340230f6bf
2 changed files with 7 additions and 4 deletions
|
@ -49,11 +49,12 @@ ErrorOr<NonnullRefPtr<CalendarWidget>> CalendarWidget::create(GUI::Window* paren
|
|||
view_month_action->set_checked(true);
|
||||
|
||||
auto view_year_action = TRY(widget->create_view_year_action());
|
||||
auto view_type_action_group = make<GUI::ActionGroup>();
|
||||
|
||||
view_type_action_group->set_exclusive(true);
|
||||
view_type_action_group->add_action(*view_month_action);
|
||||
view_type_action_group->add_action(*view_year_action);
|
||||
widget->m_view_type_action_group = make<GUI::ActionGroup>();
|
||||
widget->m_view_type_action_group->set_exclusive(true);
|
||||
widget->m_view_type_action_group->add_action(*view_month_action);
|
||||
widget->m_view_type_action_group->add_action(*view_year_action);
|
||||
|
||||
auto default_view = Config::read_string("Calendar"sv, "View"sv, "DefaultView"sv, "Month"sv);
|
||||
if (default_view == "Year")
|
||||
view_year_action->set_checked(true);
|
||||
|
|
|
@ -42,6 +42,8 @@ private:
|
|||
ErrorOr<NonnullRefPtr<GUI::Action>> create_view_year_action();
|
||||
ErrorOr<NonnullRefPtr<GUI::Action>> create_open_settings_action();
|
||||
|
||||
OwnPtr<GUI::ActionGroup> m_view_type_action_group;
|
||||
|
||||
RefPtr<EventCalendar> m_event_calendar;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue