forked from qt-creator/qt-creator
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>
This commit is contained in:
committed by
Christian Stenger
parent
db31db26dd
commit
2484b50a99
@@ -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);
|
||||
|
@@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user