vcl/qt5/QtAccessibleWidget.cxx    |    6 +++++-
 vcl/qt5/QtInstanceDrawingArea.cxx |   13 +++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit 32c7035824e50429c4ffeb43d0bdf306ba8874e9
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri May 2 00:12:25 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri May 2 09:32:55 2025 +0200

    tdf#130857 qt weld a11y: Add custom a11y to registry
    
    Insert the mapping between XAccessible and the associated
    QLabel to QtAccessibleRegistry for the case where a custom
    a11y object is used as implemented in previous commit
    
        Change-Id: I4686f1d6c5862fea38af626facff785ed5e9f9dd
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Thu May 1 23:21:55 2025 +0200
    
            tdf#130857 qt weld a11y: Support custom DrawingArea a11y
    
    This makes sure that the existing QtAccessibleWidget
    is used for the XAccessible later, instead of creating
    another one/a QtXAccessible later.
    
    See also
    
        commit 61c0c1286dbd9015809ba8ee5ee687b612438bef
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Wed Aug 24 13:47:25 2022 +0200
    
            qt a11y: Remember associated QObject also for non-QtXAcccessible 
case
    
    for a similar change just a few lines further down, which
    also has more details.
    
    This commit makes the paragraph child in the spelling dialog
    report the edit view/drawing area accessible as its parent on the
    a11y layer as it should, and thus also makes Accerciser
    highlight the correct area on screen when clicking on them,
    while that was not the case previously (at least on Wayland)
    with SAL_VCL_QT_USE_WELDED_WIDGETS=1 in a WIP branch adding
    support for using native Qt widgets for the spelling dialog.
    
    Change-Id: I57a8494152b867a999aecff0e94c2e7b4373881e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184882
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx
index e1f6dcea5814..dcd5a7a40801 100644
--- a/vcl/qt5/QtAccessibleWidget.cxx
+++ b/vcl/qt5/QtAccessibleWidget.cxx
@@ -810,7 +810,11 @@ QAccessibleInterface* 
QtAccessibleWidget::customFactory(const QString& classname
 
     const QVariant aAccVariant = pObject->property(PROPERTY_ACCESSIBLE);
     if (aAccVariant.isValid() && aAccVariant.canConvert<QtAccessibleWidget*>())
-        return aAccVariant.value<QtAccessibleWidget*>();
+    {
+        QtAccessibleWidget* pAccessibleWidget = 
aAccVariant.value<QtAccessibleWidget*>();
+        QtAccessibleRegistry::insert(pAccessibleWidget->m_xAccessible, 
pObject);
+        return pAccessibleWidget;
+    }
 
     if (classname == QLatin1String("QtWidget") && pObject->isWidgetType())
     {
commit 89be90b92f15e318e1ecb3663cde80e5caa839c1
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu May 1 23:56:46 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri May 2 09:32:49 2025 +0200

    tdf#130857 qt weld a11y: Implement getting location on screen
    
    This makes Accerciser highlight the correct area
    on screen when selecting the
    "Not in dictionary" edit view  in a WIP branch adding support
    for the spelling dialog using native Qt widgets with the
    qt6 VCL plugin with SAL_VCL_QT_USE_WELDED_WIDGETS=1.
    
    (The method gets called from WeldEditView::getLocationOnScreen.)
    
    Change-Id: Ie310435ec87339629470c47c9ef5f310a291d3a2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184881
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/qt5/QtInstanceDrawingArea.cxx 
b/vcl/qt5/QtInstanceDrawingArea.cxx
index 35cc1b47d36f..345163849fd0 100644
--- a/vcl/qt5/QtInstanceDrawingArea.cxx
+++ b/vcl/qt5/QtInstanceDrawingArea.cxx
@@ -83,8 +83,17 @@ a11yrelationset 
QtInstanceDrawingArea::get_accessible_relation_set()
 
 AbsoluteScreenPixelPoint 
QtInstanceDrawingArea::get_accessible_location_on_screen()
 {
-    assert(false && "Not implemented yet");
-    return AbsoluteScreenPixelPoint(0, 0);
+    SolarMutexGuard g;
+
+    AbsoluteScreenPixelPoint aLocation;
+    GetQtInstance().RunInMainThread([&] {
+        QPoint aPos = getQWidget()->pos();
+        if (QWidget* pParent = getQWidget()->parentWidget())
+            aPos = pParent->mapToGlobal(aPos);
+        aLocation = AbsoluteScreenPixelPoint(toPoint(aPos));
+    });
+
+    return aLocation;
 }
 
 void QtInstanceDrawingArea::click(const Point&) { assert(false && "Not 
implemented yet"); }

Reply via email to