diff options
Diffstat (limited to 'src/plugins')
9 files changed, 107 insertions, 65 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamessagedialog.mm b/src/plugins/platforms/cocoa/qcocoamessagedialog.mm index dab348beaa4..7a6f010ba8f 100644 --- a/src/plugins/platforms/cocoa/qcocoamessagedialog.mm +++ b/src/plugins/platforms/cocoa/qcocoamessagedialog.mm @@ -88,6 +88,11 @@ bool QCocoaMessageDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality w return false; } + // Tahoe has issues with window-modal alert buttons not responding to mouse + if (windowModality == Qt::WindowModal + && QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSTahoe) + return false; + // And without options we don't know what to show if (!options()) return false; diff --git a/src/plugins/platforms/wasm/qwasmaccessibility.cpp b/src/plugins/platforms/wasm/qwasmaccessibility.cpp index 5807d157636..eb36f7351d0 100644 --- a/src/plugins/platforms/wasm/qwasmaccessibility.cpp +++ b/src/plugins/platforms/wasm/qwasmaccessibility.cpp @@ -322,6 +322,16 @@ void QWasmAccessibility::setProperty(emscripten::val element, const std::string element.set(property, val); } +void QWasmAccessibility::setNamedAttribute(QAccessibleInterface *iface, const std::string &attribute, QAccessible::Text text) +{ + const emscripten::val element = getHtmlElement(iface); + setAttribute(element, attribute, iface->text(text).toStdString()); +} +void QWasmAccessibility::setNamedProperty(QAccessibleInterface *iface, const std::string &property, QAccessible::Text text) +{ + const emscripten::val element = getHtmlElement(iface); + setProperty(element, property, iface->text(text).toStdString()); +} void QWasmAccessibility::addEventListener(QAccessibleInterface *iface, emscripten::val element, const char *eventType) { @@ -331,6 +341,17 @@ void QWasmAccessibility::addEventListener(QAccessibleInterface *iface, emscripte true); } +void QWasmAccessibility::sendEvent(QAccessibleInterface *iface, QAccessible::Event eventType) +{ + if (iface->object()) { + QAccessibleEvent event(iface->object(), eventType); + handleUpdateByInterfaceRole(&event); + } else { + QAccessibleEvent event(iface, eventType); + handleUpdateByInterfaceRole(&event); + } +} + emscripten::val QWasmAccessibility::createHtmlElement(QAccessibleInterface *iface) { // Get the html container element for the interface; this depends on which @@ -484,11 +505,11 @@ emscripten::val QWasmAccessibility::createHtmlElement(QAccessibleInterface *ifac m_elements[iface] = element; setHtmlElementGeometry(iface); - setHtmlElementTextName(iface); setHtmlElementDisabled(iface); setHtmlElementVisibility(iface, !iface->state().invisible); handleIdentifierUpdate(iface); handleDescriptionChanged(iface); + sendEvent(iface, QAccessible::NameChanged); linkToParent(iface); // Link in child elements @@ -624,28 +645,6 @@ void QWasmAccessibility::setHtmlElementGeometry(emscripten::val element, QRect g style.set("height", std::to_string(geometry.height()) + "px"); } -void QWasmAccessibility::setHtmlElementTextName(QAccessibleInterface *iface) -{ - const emscripten::val element = getHtmlElement(iface); - const QString name = iface->text(QAccessible::Name); - const QString value = iface->text(QAccessible::Value); - - // A <div> cannot contain aria-label - if (iface->role() == QAccessible::StaticText) - setProperty(element, "innerText", name.toStdString()); - else if (iface->role() == QAccessible::EditableText) - setProperty(element, "value", value.toStdString()); - else - setAttribute(element, "aria-label", name.toStdString()); -} - -void QWasmAccessibility::setHtmlElementTextNameLE(QAccessibleInterface *iface) -{ - const emscripten::val element = getHtmlElement(iface); - QString value = iface->text(QAccessible::Value); - setProperty(element, "value", value.toStdString()); -} - void QWasmAccessibility::setHtmlElementFocus(QAccessibleInterface *iface) { const auto element = getHtmlElement(iface); @@ -677,7 +676,8 @@ void QWasmAccessibility::handleStaticTextUpdate(QAccessibleEvent *event) { switch (event->type()) { case QAccessible::NameChanged: { - setHtmlElementTextName(event->accessibleInterface()); + // StaticText is a div + setNamedProperty(event->accessibleInterface(), "innerText", QAccessible::Name); } break; default: qCDebug(lcQpaAccessibility) << "TODO: implement handleStaticTextUpdate for event" << event->type(); @@ -698,7 +698,7 @@ void QWasmAccessibility::handleLineEditUpdate(QAccessibleEvent *event) setProperty(element, "type", "text"); } break; case QAccessible::NameChanged: { - setHtmlElementTextName(event->accessibleInterface()); + setNamedProperty(event->accessibleInterface(), "value", QAccessible::Value); } break; case QAccessible::ObjectShow: case QAccessible::Focus: { @@ -711,12 +711,12 @@ void QWasmAccessibility::handleLineEditUpdate(QAccessibleEvent *event) else setProperty(element, "type", "text"); } - setHtmlElementTextNameLE(iface); + setNamedProperty(event->accessibleInterface(), "value", QAccessible::Value); } break; case QAccessible::TextRemoved: case QAccessible::TextInserted: case QAccessible::TextCaretMoved: { - setHtmlElementTextNameLE(event->accessibleInterface()); + setNamedProperty(event->accessibleInterface(), "value", QAccessible::Value); } break; default: qCDebug(lcQpaAccessibility) << "TODO: implement handleLineEditUpdate for event" << event->type(); @@ -751,7 +751,15 @@ void QWasmAccessibility::handleEventFromHtmlElement(const emscripten::val event) void QWasmAccessibility::handleButtonUpdate(QAccessibleEvent *event) { - qCDebug(lcQpaAccessibility) << "TODO: implement handleButtonUpdate for event" << event->type(); + switch (event->type()) { + case QAccessible::Focus: + case QAccessible::NameChanged: { + setNamedAttribute(event->accessibleInterface(), "aria-label", QAccessible::Name); + } break; + default: + qCDebug(lcQpaAccessibility) << "TODO: implement handleCheckBoxUpdate for event" << event->type(); + break; + } } void QWasmAccessibility::handleCheckBoxUpdate(QAccessibleEvent *event) @@ -759,7 +767,7 @@ void QWasmAccessibility::handleCheckBoxUpdate(QAccessibleEvent *event) switch (event->type()) { case QAccessible::Focus: case QAccessible::NameChanged: { - setHtmlElementTextName(event->accessibleInterface()); + setNamedAttribute(event->accessibleInterface(), "aria-label", QAccessible::Name); } break; case QAccessible::StateChanged: { QAccessibleInterface *accessible = event->accessibleInterface(); @@ -778,7 +786,8 @@ void QWasmAccessibility::handleSwitchUpdate(QAccessibleEvent *event) switch (event->type()) { case QAccessible::Focus: case QAccessible::NameChanged: { - setHtmlElementTextName(event->accessibleInterface()); + /* A switch is like a button in this regard */ + setNamedAttribute(event->accessibleInterface(), "aria-label", QAccessible::Name); } break; case QAccessible::StateChanged: { QAccessibleInterface *accessible = event->accessibleInterface(); @@ -841,7 +850,7 @@ void QWasmAccessibility::handleDialogUpdate(QAccessibleEvent *event) { case QAccessible::Focus: case QAccessible::DialogStart: case QAccessible::StateChanged: { - setHtmlElementTextName(event->accessibleInterface()); + setNamedAttribute(event->accessibleInterface(), "aria-label", QAccessible::Name); } break; default: qCDebug(lcQpaAccessibility) << "TODO: implement handleLineEditUpdate for event" << event->type(); @@ -869,10 +878,10 @@ void QWasmAccessibility::populateAccessibilityTree(QAccessibleInterface *iface) linkToParent(iface); setHtmlElementVisibility(iface, !iface->state().invisible); setHtmlElementGeometry(iface); - setHtmlElementTextName(iface); setHtmlElementDisabled(iface); handleIdentifierUpdate(iface); handleDescriptionChanged(iface); + sendEvent(iface, QAccessible::NameChanged); } } for (int i = 0; i < iface->childCount(); ++i) @@ -884,7 +893,7 @@ void QWasmAccessibility::handleRadioButtonUpdate(QAccessibleEvent *event) switch (event->type()) { case QAccessible::Focus: case QAccessible::NameChanged: { - setHtmlElementTextName(event->accessibleInterface()); + setNamedAttribute(event->accessibleInterface(), "aria-label", QAccessible::Name); } break; case QAccessible::StateChanged: { QAccessibleInterface *accessible = event->accessibleInterface(); @@ -905,7 +914,7 @@ void QWasmAccessibility::handleSpinBoxUpdate(QAccessibleEvent *event) } break; case QAccessible::Focus: case QAccessible::NameChanged: { - setHtmlElementTextName(event->accessibleInterface()); + setNamedAttribute(event->accessibleInterface(), "aria-label", QAccessible::Name); } break; case QAccessible::ValueChanged: { QAccessibleInterface *accessible = event->accessibleInterface(); @@ -927,7 +936,7 @@ void QWasmAccessibility::handleSliderUpdate(QAccessibleEvent *event) } break; case QAccessible::Focus: case QAccessible::NameChanged: { - setHtmlElementTextName(event->accessibleInterface()); + setNamedAttribute(event->accessibleInterface(), "aria-label", QAccessible::Name); } break; case QAccessible::ValueChanged: { QAccessibleInterface *accessible = event->accessibleInterface(); @@ -946,7 +955,7 @@ void QWasmAccessibility::handleScrollBarUpdate(QAccessibleEvent *event) switch (event->type()) { case QAccessible::Focus: case QAccessible::NameChanged: { - setHtmlElementTextName(event->accessibleInterface()); + setNamedAttribute(event->accessibleInterface(), "aria-label", QAccessible::Name); } break; case QAccessible::ValueChanged: { QAccessibleInterface *accessible = event->accessibleInterface(); @@ -965,10 +974,10 @@ void QWasmAccessibility::handlePageTabUpdate(QAccessibleEvent *event) { switch (event->type()) { case QAccessible::NameChanged: { - setHtmlElementTextName(event->accessibleInterface()); + setNamedAttribute(event->accessibleInterface(), "aria-label", QAccessible::Name); } break; case QAccessible::Focus: { - setHtmlElementTextName(event->accessibleInterface()); + setNamedAttribute(event->accessibleInterface(), "aria-label", QAccessible::Name); } break; default: qDebug() << "TODO: implement handlePageTabUpdate for event" << event->type(); @@ -980,10 +989,10 @@ void QWasmAccessibility::handlePageTabListUpdate(QAccessibleEvent *event) { switch (event->type()) { case QAccessible::NameChanged: { - setHtmlElementTextName(event->accessibleInterface()); + setNamedAttribute(event->accessibleInterface(), "aria-label", QAccessible::Name); } break; case QAccessible::Focus: { - setHtmlElementTextName(event->accessibleInterface()); + setNamedAttribute(event->accessibleInterface(), "aria-label", QAccessible::Name); } break; default: qDebug() << "TODO: implement handlePageTabUpdate for event" << event->type(); @@ -1106,13 +1115,19 @@ void QWasmAccessibility::relinkParentForChildren(QAccessibleInterface *iface) void QWasmAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) { + if (handleUpdateByEventType(event)) + handleUpdateByInterfaceRole(event); +} + +bool QWasmAccessibility::handleUpdateByEventType(QAccessibleEvent *event) +{ if (!m_accessibilityEnabled) - return; + return false; QAccessibleInterface *iface = event->accessibleInterface(); if (!iface) { - qWarning() << "notifyAccessibilityUpdate with null a11y interface" << event->type() << event->object(); - return; + qWarning() << "handleUpdateByEventType with null a11y interface" << event->type() << event->object(); + return false; } // Handle event types that creates/removes objects. @@ -1120,13 +1135,13 @@ void QWasmAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) case QAccessible::ObjectCreated: // Do nothing, there are too many changes to the interface // before ObjectShow is called - return; + return false; case QAccessible::ObjectDestroyed: // The object might be under destruction, and the interface is not valid // but we can look at the pointer, removeObject(iface); - return; + return false; case QAccessible::ObjectShow: // We do not get ObjectCreated from widgets, we get ObjectShow createObject(iface); @@ -1142,7 +1157,7 @@ void QWasmAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) }; if (getHtmlElement(iface).isUndefined()) - return; + return false; // Handle some common event types. See // https://doc.qt.io/qt-5/qaccessible.html#Event-enum @@ -1155,7 +1170,7 @@ void QWasmAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) case QAccessible::DescriptionChanged: handleDescriptionChanged(iface); - return; + return false; case QAccessible::Focus: // We do not get all callbacks for the geometry @@ -1166,7 +1181,7 @@ void QWasmAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) case QAccessible::IdentifierChanged: handleIdentifierUpdate(iface); - return; + return false; case QAccessible::ObjectShow: linkToParent(iface); @@ -1174,23 +1189,37 @@ void QWasmAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) // Sync up properties on show; setHtmlElementGeometry(iface); - setHtmlElementTextName(iface); + sendEvent(iface, QAccessible::NameChanged); break; case QAccessible::ObjectHide: linkToParent(iface); setHtmlElementVisibility(iface, false); - return; + return false; case QAccessible::LocationChanged: setHtmlElementGeometry(iface); - return; + return false; // TODO: maybe handle more types here default: break; }; + return true; +} + +void QWasmAccessibility::handleUpdateByInterfaceRole(QAccessibleEvent *event) +{ + if (!m_accessibilityEnabled) + return; + + QAccessibleInterface *iface = event->accessibleInterface(); + if (!iface) { + qWarning() << "handleUpdateByInterfaceRole with null a11y interface" << event->type() << event->object(); + return; + } + // Switch on interface role, see // https://doc.qt.io/qt-5/qaccessibleinterface.html#role switch (iface->role()) { @@ -1198,7 +1227,7 @@ void QWasmAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) handleStaticTextUpdate(event); break; case QAccessible::Button: - handleStaticTextUpdate(event); + handleButtonUpdate(event); break; case QAccessible::CheckBox: handleCheckBoxUpdate(event); diff --git a/src/plugins/platforms/wasm/qwasmaccessibility.h b/src/plugins/platforms/wasm/qwasmaccessibility.h index ddbfec918d6..f20c7db5ac3 100644 --- a/src/plugins/platforms/wasm/qwasmaccessibility.h +++ b/src/plugins/platforms/wasm/qwasmaccessibility.h @@ -73,8 +73,6 @@ private: void setHtmlElementVisibility(QAccessibleInterface *iface, bool visible); void setHtmlElementGeometry(QAccessibleInterface *iface); void setHtmlElementGeometry(emscripten::val element, QRect geometry); - void setHtmlElementTextName(QAccessibleInterface *iface); - void setHtmlElementTextNameLE(QAccessibleInterface *iface); void setHtmlElementFocus(QAccessibleInterface *iface); void setHtmlElementDisabled(QAccessibleInterface *iface); void setHtmlElementOrientation(emscripten::val element, QAccessibleInterface *iface); @@ -105,6 +103,9 @@ private: void relinkParentForChildren(QAccessibleInterface *iface); void notifyAccessibilityUpdate(QAccessibleEvent *event) override; + bool handleUpdateByEventType(QAccessibleEvent *event); + void handleUpdateByInterfaceRole(QAccessibleEvent *event); + void setRootObject(QObject *o) override; void initialize() override; void cleanup() override; @@ -117,7 +118,11 @@ private: void setProperty(emscripten::val element, const std::string &attr, const char *val); void setProperty(emscripten::val element, const std::string &attr, bool val); + void setNamedAttribute(QAccessibleInterface *iface, const std::string &attribute, QAccessible::Text text); + void setNamedProperty(QAccessibleInterface *iface, const std::string &property, QAccessible::Text text); + void addEventListener(QAccessibleInterface *, emscripten::val element, const char *eventType); + void sendEvent(QAccessibleInterface *iface, QAccessible::Event eventType); private: static QWasmAccessibility *s_instance; diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp index 92c746d3541..edbeb1f72ea 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.cpp @@ -40,6 +40,11 @@ void QWaylandClientExtensionPrivate::globalRemoved(const RegistryGlobal &global) } } +/*! + \class QWaylandClientExtension + \internal +*/ + void QWaylandClientExtension::initialize() { Q_D(QWaylandClientExtension); diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 1c3a3909bc2..15ab167c83f 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -179,9 +179,6 @@ QWindowsContextPrivate::QWindowsContextPrivate() QWindowsContext::QWindowsContext() : d(new QWindowsContextPrivate) { -#ifdef Q_CC_MSVC -# pragma warning( disable : 4996 ) -#endif m_instance = this; } diff --git a/src/plugins/sqldrivers/sqlite/CMakeLists.txt b/src/plugins/sqldrivers/sqlite/CMakeLists.txt index 6ca4b120ccf..827cae9530b 100644 --- a/src/plugins/sqldrivers/sqlite/CMakeLists.txt +++ b/src/plugins/sqldrivers/sqlite/CMakeLists.txt @@ -74,12 +74,12 @@ qt_internal_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_largefile SQLITE_DISABLE_LFS ) -qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_localtime_r +qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_localtime_r AND NOT QT_FEATURE_system_sqlite DEFINES HAVE_LOCALTIME_R=1 ) -qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_localtime_s +qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_localtime_s AND NOT QT_FEATURE_system_sqlite DEFINES HAVE_LOCALTIME_S=1 ) diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index 410750d941d..c8cd7c26f61 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -1875,7 +1875,7 @@ QRect QWindows11Style::subElementRect(QStyle::SubElement element, const QStyleOp case QStyle::SE_RadioButtonIndicator: case QStyle::SE_CheckBoxIndicator: ret = QWindowsVistaStyle::subElementRect(element, option, widget); - ret.moveLeft(contentItemHMargin); + ret.moveLeft(ret.left() + contentItemHMargin); break; case QStyle::SE_ComboBoxFocusRect: case QStyle::SE_CheckBoxFocusRect: @@ -2621,7 +2621,7 @@ QIcon QWindows11Style::standardIcon(StandardPixmap standardIcon, case SP_ToolBarHorizontalExtensionButton: case SP_ToolBarVerticalExtensionButton: { if (d->m_toolbarExtensionButton.isNull()) { - auto e = new WinFontIconEngine(More.at(0), d->assetFont); + auto e = new WinFontIconEngine(More, d->assetFont); e->setScale(1.0); d->m_toolbarExtensionButton = QIcon(e); } diff --git a/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp b/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp index 22ca18b10bf..7389635108b 100644 --- a/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp +++ b/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp @@ -1716,7 +1716,9 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt QWindowsThemeData popupbackgroundTheme(widget, painter, QWindowsVistaStylePrivate::MenuTheme, MENU_POPUPBACKGROUND, stateId, option->rect); d->drawBackground(popupbackgroundTheme); + return; } + break; case PE_PanelMenuBar: break; @@ -4959,8 +4961,7 @@ QIcon QWindowsVistaStyle::standardIcon(StandardPixmap standardIcon, return QWindowsStyle::standardIcon(standardIcon, option, widget); } - -WinFontIconEngine::WinFontIconEngine(const QChar &glyph, const QFont &font) +WinFontIconEngine::WinFontIconEngine(const QString &glyph, const QFont &font) : QFontIconEngine({}, font) , m_font(font) , m_glyph(glyph) diff --git a/src/plugins/styles/modernwindows/qwindowsvistastyle_p_p.h b/src/plugins/styles/modernwindows/qwindowsvistastyle_p_p.h index cf982ceb133..23b34547faa 100644 --- a/src/plugins/styles/modernwindows/qwindowsvistastyle_p_p.h +++ b/src/plugins/styles/modernwindows/qwindowsvistastyle_p_p.h @@ -184,7 +184,7 @@ private: class WinFontIconEngine : public QFontIconEngine { public: - WinFontIconEngine(const QChar &glyph, const QFont &font); + WinFontIconEngine(const QString &glyph, const QFont &font); QString key() const override; QIconEngine *clone() const override; @@ -194,7 +194,7 @@ public: protected: QFont m_font; - QChar m_glyph; + QString m_glyph; double m_scale = 0.7; }; |
