From 38fc8d845d096d158140af14140471b6ba8bd172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Arve=20S=C3=A6ther?= Date: Tue, 28 Jan 2025 17:07:22 +0100 Subject: [PATCH] Do not lie about keyboard shortcut to macOS users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QKeySequence::HelpContents maps to 'F1' on all platforms except macOS, where it maps to '⌘ + ?' Change-Id: Ic9b0acdbd686591792fcac1195f03ba334bde3fa Reviewed-by: Richard Moe Gustavsen --- examples/widgets/gallery/widgetgallery.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/widgets/gallery/widgetgallery.cpp b/examples/widgets/gallery/widgetgallery.cpp index 92c878fcb6e..deef6b42181 100644 --- a/examples/widgets/gallery/widgetgallery.cpp +++ b/examples/widgets/gallery/widgetgallery.cpp @@ -149,7 +149,9 @@ WidgetGallery::WidgetGallery(QWidget *parent) QGuiApplication::styleHints()->setColorScheme(static_cast(index)); }); - auto helpLabel = createWidget1(tr("Press F1 over a widget to see Documentation"), "helpLabel"); + const QKeySequence helpKeySequence(QKeySequence::HelpContents); + auto helpLabel = createWidget1(tr("Press %1 over a widget to see Documentation") + .arg(helpKeySequence.toString(QKeySequence::NativeText)), "helpLabel"); auto disableWidgetsCheckBox = createWidget1(tr("&Disable widgets"), "disableWidgetsCheckBox"); @@ -197,7 +199,7 @@ WidgetGallery::WidgetGallery(QWidget *parent) setWindowTitle(tr("Widget Gallery Qt %1").arg(QT_VERSION_STR)); - new QShortcut(QKeySequence::HelpContents, this, this, &WidgetGallery::helpOnCurrentWidget); + new QShortcut(helpKeySequence, this, this, &WidgetGallery::helpOnCurrentWidget); } void WidgetGallery::setVisible(bool visible)