[Libreoffice-commits] core.git: vcl/qt5

Michael Weghorn (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 21 15:43:50 UTC 2021


 vcl/qt5/Qt5AccessibleWidget.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit bdf14fd8ea18b94cdcdf2b194d6644f87d69d96b
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Wed Jul 21 14:12:31 2021 +0200
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Wed Jul 21 17:43:16 2021 +0200

    qt5 a11y: Implement Qt5AccessibleWidget::cursorPosition
    
    Use 'XAccessibleText::getCaretPosition', similar to
    how 'Qt5AccessibleWidget::setCursorPosition' calls
    'XAccessibleText::setCaretPosition'.
    
    Change-Id: Ic9e4533d6a39de90fee7ec2e8e0bd3fc6a69bba0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119320
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx
index 0cf79919501c..33ad3634f24e 100644
--- a/vcl/qt5/Qt5AccessibleWidget.cxx
+++ b/vcl/qt5/Qt5AccessibleWidget.cxx
@@ -872,7 +872,7 @@ QString Qt5AccessibleWidget::attributes(int offset, int* startOffset, int* endOf
     // handle special values for offset the same way base class's QAccessibleTextWidget::attributes does
     // (as defined in IAccessible 2: -1 -> length, -2 -> cursor position)
     if (offset == -2)
-        offset = cursorPosition(); // currently always returns 0
+        offset = cursorPosition();
 
     const int nTextLength = characterCount();
     if (offset == -1 || offset == nTextLength)
@@ -927,11 +927,15 @@ QRect Qt5AccessibleWidget::characterRect(int /* offset */) const
     SAL_INFO("vcl.qt5", "Unsupported QAccessibleTextInterface::characterRect");
     return QRect();
 }
+
 int Qt5AccessibleWidget::cursorPosition() const
 {
-    SAL_INFO("vcl.qt5", "Unsupported QAccessibleTextInterface::cursorPosition");
+    Reference<XAccessibleText> xText(m_xAccessible, UNO_QUERY);
+    if (xText.is())
+        return xText->getCaretPosition();
     return 0;
 }
+
 int Qt5AccessibleWidget::offsetAtPoint(const QPoint& /* point */) const
 {
     SAL_INFO("vcl.qt5", "Unsupported QAccessibleTextInterface::offsetAtPoint");


More information about the Libreoffice-commits mailing list