Qt: Make "Fullscreen" toolbar button and menu item checkable

This commit is contained in:
Davide Pesavento 2025-07-15 23:31:35 -04:00 committed by Connor McLaughlin
parent 2f13538cc0
commit 1289e045b9
3 changed files with 8 additions and 9 deletions

View File

@ -401,7 +401,7 @@ void MainWindow::createDisplayWidget(bool fullscreen, bool render_to_main, bool
m_ui.actionViewSystemDisplay->setChecked(true);
}
updateDisplayRelatedActions(true, render_to_main, fullscreen);
updateDisplayRelatedActions(true, fullscreen);
updateShortcutActions(false);
updateDisplayWidgetCursor();
@ -483,7 +483,7 @@ void MainWindow::destroyDisplayWidget(bool show_game_list)
m_exclusive_fullscreen_requested = false;
updateDisplayRelatedActions(false, false, false);
updateDisplayRelatedActions(false, false);
updateShortcutActions(false);
}
@ -497,18 +497,14 @@ void MainWindow::updateDisplayWidgetCursor()
m_display_widget->updateCursor(s_system_valid && !s_system_paused && shouldHideMouseCursor());
}
void MainWindow::updateDisplayRelatedActions(bool has_surface, bool render_to_main, bool fullscreen)
void MainWindow::updateDisplayRelatedActions(bool has_surface, bool fullscreen)
{
// rendering to main, or switched to gamelist/grid
m_ui.actionViewSystemDisplay->setEnabled(wantsDisplayWidget() && QtHost::CanRenderToMainWindow());
m_ui.menuWindowSize->setEnabled(has_surface && !fullscreen);
m_ui.actionFullscreen->setEnabled(has_surface);
{
QSignalBlocker blocker(m_ui.actionFullscreen);
m_ui.actionFullscreen->setChecked(fullscreen);
}
}
void MainWindow::focusDisplayWidget()
{

View File

@ -271,7 +271,7 @@ private:
void createDisplayWidget(bool fullscreen, bool render_to_main, bool use_main_window_pos);
void destroyDisplayWidget(bool show_game_list);
void updateDisplayWidgetCursor();
void updateDisplayRelatedActions(bool has_surface, bool render_to_main, bool fullscreen);
void updateDisplayRelatedActions(bool has_surface, bool fullscreen);
void doSettings(const char* category = nullptr);
void openGamePropertiesForCurrentGame(const char* category = nullptr);

View File

@ -421,6 +421,9 @@
</property>
</action>
<action name="actionFullscreen">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset theme="fullscreen-line"/>
</property>