wasm: Don't grab menu bar item shortcuts on Mac
On Mac there's no concept of menu bar alt+key shortcuts. Therefore we cannot expect users on Mac, even when in a web application, to be familiar with those. Additionally, alt+key combinations yield special characters on Mac so that is the behavior we should support in WASM apps on Mac. To disable the menu bar item shortcuts, a new platform style hint UnderlineShortcut was created. Shortcut grabbing was disabled exactly the same as on regular Mac builds, i.e. through qt_set_sequence_auto_mnemonic. Task-number: QTBUG-76587 Change-Id: Ice6ed123c01e46b58d6d2c3e639813161b5a9a40 Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>bb10
parent
d3dfe5a3b7
commit
a1867208a6
|
|
@ -10,7 +10,7 @@
|
|||
#include "qwasmaccessibility.h"
|
||||
#include "qwasmservices.h"
|
||||
#include "qwasmoffscreensurface.h"
|
||||
|
||||
#include "qwasmplatform.h"
|
||||
#include "qwasmwindow.h"
|
||||
#include "qwasmbackingstore.h"
|
||||
#include "qwasmfontdatabase.h"
|
||||
|
|
@ -32,6 +32,8 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
extern void qt_set_sequence_auto_mnemonic(bool);
|
||||
|
||||
using namespace emscripten;
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
|
@ -81,6 +83,9 @@ QWasmIntegration::QWasmIntegration()
|
|||
{
|
||||
s_instance = this;
|
||||
|
||||
if (platform() == Platform::MacOS)
|
||||
qt_set_sequence_auto_mnemonic(false);
|
||||
|
||||
touchPoints = emscripten::val::global("navigator")["maxTouchPoints"].as<int>();
|
||||
|
||||
// Create screens for container elements. Each container element will ultimately become a
|
||||
|
|
@ -226,10 +231,14 @@ QAbstractEventDispatcher *QWasmIntegration::createEventDispatcher() const
|
|||
|
||||
QVariant QWasmIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
|
||||
{
|
||||
if (hint == ShowIsFullScreen)
|
||||
switch (hint) {
|
||||
case ShowIsFullScreen:
|
||||
return true;
|
||||
|
||||
return QPlatformIntegration::styleHint(hint);
|
||||
case UnderlineShortcut:
|
||||
return platform() != Platform::MacOS;
|
||||
default:
|
||||
return QPlatformIntegration::styleHint(hint);
|
||||
}
|
||||
}
|
||||
|
||||
Qt::WindowState QWasmIntegration::defaultWindowState(Qt::WindowFlags flags) const
|
||||
|
|
|
|||
Loading…
Reference in New Issue