aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2024-02-21 09:31:39 +0100
committerChristian Stenger <christian.stenger@qt.io>2024-03-11 05:21:55 +0000
commit2484b50a99dbd254f767a7f6b90aada946e2248f (patch)
tree7772048f484696ae606527a24e9c5b6ca95b4fb9
parentdb31db26dd900cd5427c2a4e4d70f00a1f4bc4cc (diff)
Fix Fullscreen action text
On macOS the action was correctly switching between "Enter Full Screen" and "Exit Full Screen", but on Windows & Linux the text was fixed to "Full Screen" and the code tried to set the check state - but forgot to make it checkable in the first place. Actually it is unclear what the "correct" behavior is on Windows & Linux. Neither on Gnome or KDE or Windows the action shows a check mark when in Full Screen mode though. Either there is a tool button with an icon, or some variation of "Exit Full Screen" or "Leave Full Screen". Change the text of the action on all platforms, use "Exit Full Screen" on all of them, but stay with just "Full Screen" on Windows & Linux (as opposed to "Enter Full Screen" on macOS). Fixes: QTCREATORBUG-30365 Change-Id: Ic55a30e32302ceb12f75449781b1aefecb370c97 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
-rw-r--r--src/plugins/coreplugin/icore.cpp2
-rw-r--r--src/plugins/coreplugin/windowsupport.cpp14
2 files changed, 7 insertions, 9 deletions
diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp
index 1834a79560..1ed0987e5a 100644
--- a/src/plugins/coreplugin/icore.cpp
+++ b/src/plugins/coreplugin/icore.cpp
@@ -1910,8 +1910,6 @@ void ICorePrivate::registerDefaultActions()
// Full Screen Action
ActionBuilder toggleFullScreenAction(this, Constants::TOGGLE_FULLSCREEN);
toggleFullScreenAction.setText(Tr::tr("Full Screen"));
- toggleFullScreenAction.setCheckable(!HostOsInfo::isMacHost());
- toggleFullScreenAction.setEnabled(false); // actual implementation in WindowSupport
toggleFullScreenAction.setDefaultKeySequence(Tr::tr("Ctrl+Meta+F"), Tr::tr("Ctrl+Shift+F11"));
if (HostOsInfo::isMacHost())
toggleFullScreenAction.setCommandAttribute(Command::CA_UpdateText);
diff --git a/src/plugins/coreplugin/windowsupport.cpp b/src/plugins/coreplugin/windowsupport.cpp
index 5c5cbbfe13..e166b57340 100644
--- a/src/plugins/coreplugin/windowsupport.cpp
+++ b/src/plugins/coreplugin/windowsupport.cpp
@@ -63,9 +63,12 @@ WindowSupport::WindowSupport(QWidget *window, const Context &context, const Cont
connect(m_closeAction, &QAction::triggered, m_window, &QWidget::close, Qt::QueuedConnection);
}
- m_toggleFullScreenAction = new QAction(this);
+ auto cmd = ActionManager::command(Constants::TOGGLE_FULLSCREEN); // created in registerDefaultActions()
+ if (QTC_GUARD(cmd))
+ m_toggleFullScreenAction = cmd->action();
+ else
+ m_toggleFullScreenAction = new QAction(this);
updateFullScreenAction();
- ActionManager::registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, ac);
connect(m_toggleFullScreenAction, &QAction::triggered, this, &WindowSupport::toggleFullScreen);
m_windowList->addWindow(window);
@@ -124,15 +127,12 @@ void WindowSupport::toggleFullScreen()
void WindowSupport::updateFullScreenAction()
{
if (m_window->isFullScreen()) {
- if (Utils::HostOsInfo::isMacHost())
- m_toggleFullScreenAction->setText(Tr::tr("Exit Full Screen"));
- else
- m_toggleFullScreenAction->setChecked(true);
+ m_toggleFullScreenAction->setText(Tr::tr("Exit Full Screen"));
} else {
if (Utils::HostOsInfo::isMacHost())
m_toggleFullScreenAction->setText(Tr::tr("Enter Full Screen"));
else
- m_toggleFullScreenAction->setChecked(false);
+ m_toggleFullScreenAction->setText(Tr::tr("Full Screen"));
}
}