diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2020-09-07 20:08:57 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2020-09-07 21:15:05 +0200 |
commit | 4461d49c6cfce22c2c96185b0a1d07bfe9709268 (patch) | |
tree | 033282965c93a7a3cd0462136049fdbcaec44b9a /vcl/qt5/Qt5AccessibleWidget.cxx | |
parent | fc78ae850eb3e1753febf3e9a2a559fcf206824c (diff) |
tdf#136323 qt5: Remember accessible object
'QAccessibleCache::insert' from the Qt library has a
'Q_ASSERT' checking that the corresponding 'QObject' for
which the 'QAccessibleInterface' provides information
is actually the same as the object passed as a parameter:
QAccessible::Id QAccessibleCache::insert(QObject *object, QAccessibleInterface *iface) const
{
// ...
QObject *obj = iface->object();
-> Q_ASSERT(object == obj);
However, 'Qt5AccessibleWidget::object' so far was always returning
'nullptr', triggering this assert when using a Qt version
not built with 'QT_NO_DEBUG'.
To fix this, remember and return the object as needed.
Change-Id: I4015b4c37aa8a073b02465df580a7235884e6cf3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102196
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl/qt5/Qt5AccessibleWidget.cxx')
-rw-r--r-- | vcl/qt5/Qt5AccessibleWidget.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx index ccca1cd2072f..9933444d9092 100644 --- a/vcl/qt5/Qt5AccessibleWidget.cxx +++ b/vcl/qt5/Qt5AccessibleWidget.cxx @@ -59,8 +59,9 @@ using namespace css::accessibility; using namespace css::beans; using namespace css::uno; -Qt5AccessibleWidget::Qt5AccessibleWidget(const Reference<XAccessible> xAccessible) +Qt5AccessibleWidget::Qt5AccessibleWidget(const Reference<XAccessible> xAccessible, QObject* pObject) : m_xAccessible(xAccessible) + , m_pObject(pObject) { Reference<XAccessibleContext> xContext = xAccessible->getAccessibleContext(); Reference<XAccessibleEventBroadcaster> xBroadcaster(xContext, UNO_QUERY); @@ -699,7 +700,7 @@ bool Qt5AccessibleWidget::isValid() const return xAc.is(); } -QObject* Qt5AccessibleWidget::object() const { return nullptr; } +QObject* Qt5AccessibleWidget::object() const { return m_pObject; } void Qt5AccessibleWidget::setText(QAccessible::Text /* t */, const QString& /* text */) {} @@ -722,13 +723,13 @@ QAccessibleInterface* Qt5AccessibleWidget::customFactory(const QString& classnam vcl::Window* pWindow = pWidget->frame().GetWindow(); if (pWindow) - return new Qt5AccessibleWidget(pWindow->GetAccessible()); + return new Qt5AccessibleWidget(pWindow->GetAccessible(), object); } if (classname == QLatin1String("Qt5XAccessible") && object) { Qt5XAccessible* pXAccessible = dynamic_cast<Qt5XAccessible*>(object); if (pXAccessible && pXAccessible->m_xAccessible.is()) - return new Qt5AccessibleWidget(pXAccessible->m_xAccessible); + return new Qt5AccessibleWidget(pXAccessible->m_xAccessible, object); } return nullptr; |