summaryrefslogtreecommitdiffstats
path: root/src/gui/accessible
Commit message (Collapse)AuthorAgeFilesLines
* Clean up windows accessibility backendMiguel Costa2024-03-2712-1445/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | What was done: * Removed headers in src/gui/accessible/windows/apisupport: as of v13.1.0, MinGW supports most of the definitions in these headers. Including uiautomation.h should be enough. * Removed the QWindowsUiaWrapper class: it's not meant to be extended or itself instantiated, is an "ultra-thin" layer (it even preserves the "all-caps" Win types of function args), and is in effect only a MinGW-bound "kludge". Instead of this class, use the UI Automation API directly, with the assumption that it's available and fully functional, as specified in the MS docs. Any gaps between this assumption and what is delivered by MinGW are bridged with specific (and explicit) temporary "kludges". * Implemented said specific "kludges" in qwindowsuiautomation. For Windows builds, the header just includes uiautomation.h, and the .cpp is empty. For MinGW, the header contains definitions still missing from uiautomation.h, and the .cpp implements functions of the UI Automation core library through imports from the uiautomationcore DLL. * Windows plugins (and tst_qaccessibility): use the UI Automation API definitions directly, instead of the "ultra-thin" wrapper. * Windows plugin builds: use uiautomationcore library, if found. What's intended: * Unburden Gui of the Windows UI Automation COM interfaces and other definitions that are copied in the uia*.h headers. * Make the Windows plugins independent of MinGW shortcomings. * Remove the QWindowsUiaWrapper class that essentially only hides these shortcomings and the "kludge" code needed to overcome them. * As MinGW adds further support to the UI Automation API over time, make it noticeable which workarounds are no longer needed. The current approach of hiding "kludges" in a wrapper class will also hide the fact that they're no longer needed, if/when that time comes. Change-Id: I0070636817d5de81d0b106e9179e2d0442362e2a Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* a11y: Add new QAccessibleAttributesInterfaceMichael Weghorn2024-02-293-2/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new QAccessibleAttributes interface that implements support for reporting (object) attributes (as compared to offset-specific text attributes, which are handled by the QAccessibleTextInterface). The concept of object attributes/properties can be found in all of ARIA, AT-SPI2 on Linux, IAccessible2 and UIA on Windows and NSAccessibility on macOS, and while some of the properties/attributes on these platforms can be mapped to from information retrieved via existing QAccessible* interfaces, a lot of relevant information cannot be made available this way. The new interface is meant to bridge this gap. Each attribute is handled as a key-value pair. Other than for the handling of text attributes (where a single string is used for all attributes, s. QAccessibleTextInterface::attributes), the object attributes handled by the new interface use the newly introduced QAccessible::Attribute enum class for keys. This helps to clearly define the semantics of each attribute and simplifies mapping to the different platform representations in the platform a11y bridges. Initially, two attribute types, Custom and Level are added, s. the documentation added with this commit for more details. Mapping of these two attributes to their platform equivalent for AT-SPI2 on Linux and UIA on Windows will be added in following commits. The Core Accessibility API Mappings specification [1] can be very useful when considering new attributes to add and how to bridge them to the specific platform APIs. Conceptually, the possibility to expose object-specific attributes might seem a good fit for the existing QAccessibleInterface, but adding new virtual methods to non-leaf classes would be an ABI-incompatible change [2], so adding a new interface/class is necessary. There is also a related discussion for Gtk 4 in [3], which - other than Gtk 3 - currently also lacks API to support many AT-SPI object attributes relevant for assistive technology like screen readers. The implementation here is also inspired by the dicussion there. A sample implementation for LibreOffice can be found at [4]. [1] https://www.w3.org/TR/core-aam-1.2/ [2] https://community.kde.org/Policies/Binary_Compatibility_Examples#Add_new_virtuals_to_a_non-leaf_class [3] https://gitlab.gnome.org/GNOME/gtk/-/issues/6196 [4] https://gerrit.libreoffice.org/c/core/+/159309 [ChangeLog][QtGui][QAccessibleAttributesInterface] Added new QAccessibleAttributesInterface that can be used to expose object attributes/properties to assistive technology. Task-number: QTBUG-119057 Change-Id: I9d51c818e82673d1e755a3c909d3e8f5bb064a35 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* a11y atspi: Map checkable and hasPopup states to AT-SPIMichael Weghorn2024-02-281-1/+4
| | | | | | | | | | | These states have direct equivalents in AT-SPI, so map them accordingly. Fixes: QTBUG-119080 Pick-to: 6.7 6.6 Change-Id: I5a78a75d135a853b3773c34aa2a45c0791cefebc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
* Doc: Fix QDoc warnings for overloadsPaul Wicking2024-02-141-2/+2
| | | | | Change-Id: I9a77b6ea0026748c7f97f73b327118f7a9212d52 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* a11y atspi: Add null checks in table iface methodsMichael Weghorn2023-12-151-12/+27
| | | | | | | | | | | | | | | Add null checks to cover the cases where QAccessibleTableInterface::cellAt returns nullptr (which happens e.g. when called with invalid indices via AT-SPI) or where the cell object doesn't implement the QAccessibleTableCellInterface, which would previously result in crashes. Fixes: QTBUG-119167 Pick-to: 6.7 6.6 Change-Id: Ieb42617b32ca829af09ae1d54f5de9ec029e3ab2 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* a11y: Fix bug where some characters were not spoken while moving cursorJan Arve Sæther2023-11-231-0/+56
| | | | | | | | | | | | | | | | | | The problem occurred when we moved the cursor to the penultimate character of the string, because the boundary condition was wrong. It is important to realize that the offsets are moved *between* each character (and also before and after the whole string), just like you would move a cursor. This means that the offsets can be in the range [0, len] (closed interval) The problem could only be reproduced with JAWS. Pick-to: 6.6 6.5 6.2 Fixes: QTBUG-115156 Change-Id: I0c5f05fa391e6c7744ab22d71afe8904b49e89bc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
* a11y atspi: Ignore malformed text attr instead of crashingMichael Weghorn2023-11-161-5/+7
| | | | | | | | | | | | | | If the attribute does not follow the required "name:value" syntax, ignore it, rather than crashing if it doesn't contain any colon. Same issue as spotted by Jan Arve Sæther during the review of a QTBUG-118106 related change that would have introduced the same issue in UIA code. Pick-to: 6.6 6.5 Change-Id: Id391502ed7aec7f09ef2826a456f2e4737af045e Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* a11y uia: Report UIA_StrikethroughStyleAttributeIdMichael Weghorn2023-11-151-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | Implement support for getting the strikethrough style (UIA attribute UIA_StrikethroughStyleAttributeId [1]) by checking for the corresponding IAccessible2 text attribute "text-line-through-type" [2] and mapping the value accordingly if set. Only report those attributes from the QAccessibleTextInterface::attributes return value, if they apply for the whole range of the QWindowsUiaTextRangeProvider. With this in place, the NVDA screen reader on Windows announces "strikethrough" as expected when asked to report the formatting information (e.g. via NVDA+f shortcut) for the QTBUG-118106 example. [1] https://learn.microsoft.com/en-us/windows/win32/winauto/uiauto-textattribute-ids [2] https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes Task-number: QTBUG-118106 Change-Id: I2fa060bd3bf493227bba766385f34d224497784c Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* a11y atspi: Bridge IA2 strikeout text attrs to AT-SPIMichael Weghorn2023-11-151-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | When the text attributes an accessible interface reports include one of the various "text-line-through-*" IAccessible2 text attributes with a value that indicates that strikethrough is applied [1], bridge that to the AT-SPI layer via the "strikethrough" attribute with a value of "true". See also the ATK documentation [2] for the `ATK_TEXT_ATTR_STRIKETHROUGH` text attribute. This will not only be used by an upcoming change that implements reporting that for Qt's own text widgets, but is also needed for third-party applications. Change for LibreOffice that makes use of this: [3] [1] https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes [2] https://gnome.pages.gitlab.gnome.org/atk/AtkText.html#AtkTextAttribute [3] https://gerrit.libreoffice.org/c/core/+/157939 Task-number: QTBUG-118106 Change-Id: Ieb98584a3c6270d8db508d59994f9ba244e2bc64 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* a11y atspi: Unescape commas in color text attributeMichael Weghorn2023-11-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The IAccessible2 text attribute specification [1], which is the applicable specification for text attributes in Qt as well, says: > These characters need to be escaped with a backslash: > backslash, colon, comma, equals, and semicolon. To adhere to this specification the commas in the "rgb(0,0,0)" value strings need to be escaped. However, AT-SPI does not expect those to be escaped, s. for example the ATK text attribute specification for ATK_TEXT_ATTR_FG_COLOR: > The foreground color. The value is an RGB > value of the format "u,u,u" Therefore, replace any backslash-escaped comma with just a comma in the AT-SPI adaptor. The context where I ran into this is LibreOffice change [3] (where LibreOffice's qt6 VCL plugin is based on Qt, but the Windows variant has its own IAccessible2-based a11y implementation). [1] https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes#formatting [2] https://gnome.pages.gitlab.gnome.org/atk/AtkText.html#AtkTextAttribute [3] https://gerrit.libreoffice.org/c/core/+/157845 Change-Id: I0a9003ff891f1bfb180a6d16a1dff2afe4002b3e Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* a11y atspi: Don't restrict top-level window to 2 a11y rolesMichael Weghorn2023-10-261-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far, only accessible interfaces of roles QAccessible::Dialog and QAccessible::Window were taken into account when trying to find the top-level window in order to calculate the window-relative coordinates relative to that one. However, an app doesn't necessarily need to have any such widget/ window as it's top-level object, but can have any widget there. Therefore, consider any a11y object that is a direct child of the application's a11y object a top-level window as well. For example, in the spinboxes example (qtbase/examples/widgets/widgets/spinboxes/spinboxes), the top-level widget is a QGroupBox, which has an accessible role of QAccessible::Client, which maps to ATSPI_ROLE_FILLER for AT-SPI on Linux. Since that's the top-level widget, window-relative coordinates should be calculated relative to it. (Without this change in place, screen coordinates would be used for the window-relative coordinates as well, as found by the script attached to QTBUG-106527.) Also deduplicate a bit and just have a single loop instead of the extra check on the interface itself at the beginning. Fixes: QTBUG-106527 Pick-to: 6.6 6.5 Change-Id: I8d2a00bcc22c71d696e4f48233afddc80e93bc1b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* a11y atspi: Update text-attribute linksMichael Weghorn2023-10-111-3/+3
| | | | | | | | | The previous ones no longer lead to the corresponding documentation. Pick-to: 6.6 6.5 Change-Id: I3f56ad71fa3f936898a25f20f718c7f65a0385a2 Reviewed-by: Liang Qi <liang.qi@qt.io>
* a11y: add runtime checking for xcb only callsLiang Qi2023-10-061-5/+7
| | | | | | | | | This amends d23562da1c4cb525d4012bee55bd665c6cafef04 . Pick-to: 6.6 6.5 Task-number: QTBUG-117535 Change-Id: I33f97f3c26409a33c8a069f9dcdfe61bbd88e2ec Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* a11y: fix the build without xcb headersLiang Qi2023-10-061-3/+11
| | | | | | | | | | | | | This amends 6802065da8706f1fc298a56b9f66ab8a815400d3 . Pure Wayland runtime and build envs without X11/xcb are more common. Need to find solution for ATSPI_MODIFIER_SHIFTLOCK on Wayland later. Pick-to: 6.6 6.5 Task-number: QTBUG-117535 Change-Id: I65d41546e3dbb86c3a939a496ed43ac1737cf539 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* a11y: fix race condition on atspi startup on WaylandHarald Sitter2023-10-041-1/+1
| | | | | | | | | | | | | | | | | | This amends db346e711c9af50566c234cfc21199680e6cb499 . Previously we could race between dbus connecting and our "manual" enabled call since we didn't take into account whether dbus is connected or not. This lead to scenarios where opening an application (in particular under Wayland) would result in the application not being able to register on the a11y bus because registration was attempted too early. By simply taking connectedness into account we'll make sure to not run registration too early anymore. Pick-to: 6.6 6.5 Change-Id: I46a3c0b57f8a0c83d3e5fae9e355c2061954031f Reviewed-by: Liang Qi <liang.qi@qt.io>
* a11y: No longer mark QAccessibleSelectionInterface as preliminaryMichael Weghorn2023-09-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since the interface was introduced as \preliminary in commit 9d16d5e2245c26e5746fd7609300b84a2a983457, everything mentioned as required to make it a publicly documented interface has been implemented: 1. An a11y bridge for macOS/VoiceOver was implemented in 98e4e992fee5152912852fb686fa3a9e546853f2 2. An a11y bridge for Windows/UI Automation was implemented in 4f9c66131d6bd4c61ef59d749ed2ec0ce402c409 3. An a11y bridge for linux/AT-SPI was implemented in ece2feee0317b582a56a0bfc783f11fe67d3edee 4. QAccessibletable implements the interface (see 092bbc9ad30c6cd7389053dc4b332cc762693676) and an implementation in QAccessibleTabBar is pending in Gerrit [ChangeLog][QtGui][QAccessibleSelectionInterface] The QAccessibleSelectionInterface that was added as preliminary in Qt 6.5 is no longer preliminary. Exposing selection to assistive technology can be achieved by implementing this interface. Change-Id: Ic6fbc67ada32122da58ce94fa0581a27ecb2ac48 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* a11y atspi: Map ButtonMenu role to AT-SPI equivalentMichael Weghorn2023-08-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | at-spi2-core commit [1] commit ed16f50e4930e32c29f80552eb698baa35b4677e Author: Fushan Wen <qydwhotmail@gmail.com> Date: Thu Jul 21 21:49:32 2022 +0800 Add `ATK_ROLE_PUSH_BUTTON_MENU` This role allows to specify a button will open a menu. It's widely used in Hamburger buttons, and Qt has QAccessible:ButtonMenu role for it. added a new ATSPI_ROLE_PUSH_BUTTON_MENU role to AT-SPI, so map to that from QAccessible::ButtonMenu when building against a recent enough AT-SPI version. Note that only a follow-up fix [2] for the above-mentioned at-spi2-core commit increased ATSPI_ROLE_COUNT accordingly: commit b0a062fd02c0cef5cc73b67aae282216856b8d8a Author: Michael Weghorn <m.weghorn@posteo.de> Date: Thu Jul 13 14:15:33 2023 +0200 Increase ATSPI_ROLE_COUNT after ed16f50e4 commit ed16f50e4930e32c29f80552eb698baa35b4677e Date: Thu Jul 21 21:49:32 2022 +0800 Add `ATK_ROLE_PUSH_BUTTON_MENU` added a new role, so increase the role count accordingly. [1] https://gitlab.gnome.org/GNOME/at-spi2-core/-/commit/ed16f50e4930e32c29f80552eb698baa35b4677e [2] https://gitlab.gnome.org/GNOME/at-spi2-core/-/commit/b0a062fd02c0cef5cc73b67aae282216856b8d8a Change-Id: If7082c7478c95c6cc68d1c735de47933599f8d2b Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Revert "Windows QPA: Add support to UiaRaiseNotificationEvent()"Jan Arve Sæther2023-08-163-28/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 566def740ec58e842e6bb37177f80e20aebaa245. The fix had some unwanted side-effects when the QAccessibleValueChangeEvent carried a value of type string. Only QComboBox uses QAccessibleValueChangeEvent in such a way. The consequence of the reverted patch was that it broke QComboBox so that the screen reader would read aloud the value change event regardless of the visibility or focus state of the QComboBox. (Thus, if you e.g. changed the QComboBox::currentIndex on a *hidden* combo box, the screen reader would still read aloud the event) This is also the root cause of what is described in QTBUG-93763. Also, due to the usage of NotificationProcessing_ImportantMostRecent the screen reader would treat it as such an important event that it would abort whatever it was currently speaking. In addition, the reverted change didn't fix any bugs and it failed to implement the suggested behavior in a correct way (as was described in QTBUG-75003 - albeit properly described after the change was merged). QTBUG-75003 has already been reopened due to this, and the change can therefore be reverted quite risk-free. Task-number: QTBUG-75003 Task-number: QTBUG-93763 Pick-to: 6.6 6.5 6.2 5.15 Change-Id: Ib91872adc563c31534fe2b30fd9c447bfcca6b40 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* a11y uia: Support ISelectionProvider2Michael Weghorn2023-07-182-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support UIA's ISelectionProvider2 interface [1] in addition to ISelectionProvider. The ISelectionProvider2 interface inherits from the ISelectionProvider interface. A follow-up commit that will introduce bridging the QAccessibleSelectionInterface, introduced in commit 9d16d5e2245c26e5746fd7609300b84a2a983457. While at it, also reserve space for the amount of children in the QList in QWindowsUiaSelectionProvider::GetSelection before inserting them one by one, to avoid reallocations. Sample use of the ISelectionProvider2 interface from NVDA's Python console [2] with this commit in place: 1) start NVDA 2) run the gallery example (examples\widgets\gallery\gallery.exe) 3) click on the "Style" listbox at the top 4) press Numpad_insert+control+z to start the NVDA Python console and capture snapshot variables 5) query and use the interface using NVDA's Python console >>> import UIAHandler >>> iselection2 = focus.parent.UIAElement.GetCurrentPattern(10034).QueryInterface(UIAHandler.IUIAutomationSelectionPattern2) >>> iselection2.CurrentItemCount 1 >>> iselection2.CurrentFirstSelectedItem.CurrentName 'windowsvista' >>> iselection2.CurrentLastSelectedItem.CurrentName 'windowsvista' [1] https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iselectionprovider2 [2] https://www.nvaccess.org/files/nvda/documentation/developerGuide.html#PythonConsole Change-Id: I43642e9e39b63c65da97af976cc322a8e5868170 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* a11y atspi: Implement TableCell methods Get{Column,Row}HeaderCellsMichael Weghorn2023-07-071-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | The AT-SPI TableCell interface's GetColumnHeaderCells and GetRowHeaderCells methods were not documented in the XML specification until recently, but are actively used, e.g. also by the Orca screen reader since commit https://gitlab.gnome.org/GNOME/orca/-/commit/ac2c4470ff4401b53b6de48e12ea5a0a6347897c ("Prefer table cell interface for getting row and column headers"). 5145d3899d338fbb82a2d314c58eb60a4a5205f8 only implemented the TableCell methods that were contained in the XML spec by then. Handle these two methods as well, and add an explicit warning for the case an unknown method is called. Related at-spi2-core commit adding the two missing methods to the AT-SPI TableCell XML spec: https://gitlab.gnome.org/GNOME/at-spi2-core/-/commit/963e99197376368e613be865e470b3af5a7a28a6 ("TableCell.xml: Add Get{Column,Row}HeaderCells methods") Fixes: QTBUG-113110 Change-Id: Ic218cdd021bbc347907762035730e6ae7d387300 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix invalid closing XML tagIevgenii Meshcheriakov2023-07-031-1/+1
| | | | | | Pick-to: 6.6 6.5 6.2 Change-Id: I1785fe855f69d7dc7d043b235ed4f3b99a6057fc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* a11y atspi: Report correct char code point when it's > 65535Michael Weghorn2023-06-091-2/+8
| | | | | | | | | | | | | | | | | | QString uses UTF-16 encoding and thus "unicode characters with code values above 65535 are stored using surrogate pairs, i.e., two consecutive QChars.". [1] When the character inside of text is retrieved using the GetCharacterAtOffset method of the AT-SPI Text interface, use QStringIterator to retrieve the character's actual codepoint instead of returning an invalid/incorrect one. [1] https://doc.qt.io/qt-6/qstring.html Pick-to: 6.6 Fixes: QTBUG-113438 Change-Id: I07108481716329fd23a92c88892eaedd3f9defc6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Accessibility: call update handler even if not activeVolker Hilsheimer2023-05-161-4/+4
| | | | | | | | | | | | | | | | | | Update handlers should get informed about accessibility updates even if the platform's accessibility bridge is not activated. E.g. an analytics or test framework (like Qt Insights) might want to use the handler to record relevant events. While many events are only delivered if QAccessible::isActive returns true to avoid spending computing time on creating the relevant event data (e.g. in item views that can be expensive), the most important events are still delivered. And requiring activation of accessibility before events can be recorded through a handler has side effects on performance, which we want to avoid. Change-Id: I896b873574f6ad2527f755912d4950aa1f898097 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Revert "fix AT_SPI_BUS_ADDRESS actually working"Samuel Thibault2023-04-191-9/+2
| | | | | | | | | | | This reverts commit be09628e151f26f602024bae6a957ffb27ac872d. because db346e711c9af50566c234cfc21199680e6cb499 avoids the issue entirely by calling this code after connecting the event. Task-number: QTBUG-43674 Pick-to: 6.5 Change-Id: I72f5b161208aa3691e194f4ba7782d288602bbf3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix accessibility on XCB when running as rootFrederik Gladhorn2023-04-151-0/+8
| | | | | | | | | | | | | | | | | | | | Accessibility actually works when running applications as root, but we would never properly connect, since the enabledChanged signal would be emitted from the constructor in this case. So after connecting the signal, check the value by hand to make sure not to miss the notification. Only applications running as root would be affected, because all other applications would go through the asynchronous pattern of getting the bus address from dbus instead. [ChangeLog][QtGui][Accessibility] On XCB applications running as root are now accessible. Pick-to: 6.5 Fixes: QTBUG-43674 Change-Id: I82cdc35f00693a8366dfcdab2f2c3c6dc5f5b783 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* a11y: Add new relations DescriptionFor, Described, Flows{From,To}Michael Weghorn2023-03-013-6/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is equivalent to the corresponding relation types defined in the IAccessible2 spec [1] (IA2_RELATION_DESCRIPTION_FOR, IA2_RELATION_DESCRIBED_BY, IA2_RELATION_FLOWS_FROM, IA2_RELATION_FLOWS_TO) and for AT-SPI on Linux [2] (relation types ATSPI_RELATION_DESCRIPTION_FOR, ATSPI_RELATION_DESCRIBED_BY, ATSPI_RELATION_FLOWS_FROM, ATSPI_RELATION_FLOWS_TO). User Interface Automation (UIA) on Windows also has corresponding properties for 3 of them [3]: UIA_DescribedByPropertyId, UIA_FlowsFromPropertyId, UIA_FlowsToPropertyId. This commit adds the new flags and implements the mapping for the AT-SPI case. Note that the relation type is conceptually always "inverted" when comparing Qt and AT-SPI (or Qt and UIA) as clarified in afbfe30093d49eff0ec4c28c220d33c233b9f807. "QAccessible::Description" instead of "QAccessible::DescriptionFor" would align better with the naming scheme of the other relations, but that is already used in the Text enum. [1] https://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/group__grp_relations.html [2] https://lazka.github.io/pgi-docs/Atspi-2.0/enums.html#Atspi.RelationType [3] https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-automation-element-propids [ChangeLog][QtGui][QAccessible::RelationFlag] Added new relation flags DescriptionFor, Described, FlowsFrom and FlowsTo. Fixes: QTBUG-105864 Change-Id: If2d46099eeea75e177358c821d1ae833a553bd0e Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* a11y: Test and document relations betterJan Arve Sæther2023-02-281-6/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The documentation for the RelationFlag enum was not very clear on what was the "first" and "second" object. And the fact that the AT-SPI backend (which these enum values originates from) inverses "first" and "second" makes it harder to understand what how it all fits together. So when (with this change) Qt documents 'QAccessible::Labelled' as "The returned object is labelled by the origin object" AT-SPI documents ATSPI_RELATION_LABELLED_BY as: "The origin object is labelled by the returned object" (Documentation for AT-SPI is rewritten so that it shares the same terminology) Notice that the two objects are exchanged, which means that even if they use the same 'Labelled' relation, the semantic gets 'inversed'. This is already the case today, so we cannot change it. Therefore, to be clear, the relation mapping will remain to be like this: Qt Relation | Maps to AT-SPI | Qt explanation ----------------+-------------------------------+-------------------------------------------------------------------------------- Label | ATSPI_RELATION_LABELLED_BY | The returned object is a Label for the origin object Labelled | ATSPI_RELATION_LABEL_FOR | The returned object is Labelled by the origin object Controller | ATSPI_RELATION_CONTROLLED_BY | The returned object is the Controller for the origin object Controlled | ATSPI_RELATION_CONTROLLER_FOR | The returned object is Controlled by the origin object This mapping can already be seen in qAccessibleRelationToAtSpiRelation() For the record, these future relations should then be mapped to like this: Qt Relation | Maps to AT-SPI | Qt explanation ----------------+-------------------------------+-------------------------------------------------------------------------------- Described | ATSPI_RELATION_DESCRIPTION_FOR| The returned object is described by the origin object DescriptionFor | ATSPI_RELATION_DESCRIBED_BY | The returned object provides a description for the origin object FlowsTo | ATSPI_RELATION_FLOWS_FROM | The returned object has content which flows logically to the origin object FlowsFrom | ATSPI_RELATION_FLOWS_TO | The returned object has content which flows logically from the origin object Change-Id: Ib245ec95564e4886dc6dbbb68abec2b23cd0e534 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
* Doc: Remove duplicate wordsAndreas Eliasson2023-02-281-1/+1
| | | | | | Change-Id: Ia7a38a1035bd34d00f20351a0adc3927e473b2e7 Pick-to: 6.5 6.4 6.2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QtGui: Disambiguate static variablesFriedemann Kleint2023-02-031-3/+3
| | | | | | | | | | | | They cause clashes in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I3c51fb41d29e5c649537b999dced7e2d413b26a7 Done-with: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
* Remove redundant qsharedpointer.h #includesAhmad Samir2023-01-311-1/+0
| | | | | | | In some cases added #include <QtCore/qshareddata.h>. Change-Id: Idc84c4ad6b0bd58e1a67af335dfcff67fdf80b2a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Move documentation for QAI::selectionInterface to source fileKai Köhne2023-01-162-3/+5
| | | | | | | | | qdoc doesn't allow documentation in headers. Pick-to: 6.5 Change-Id: I25686572aa15395bb3eb94dd637e4674e7310afe Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Use qtversion.h instead of qlibraryinfo.hMarc Mutz2022-12-091-1/+1
| | | | | | | | | | | | ... where 50b05e3e2ad969abf4b939d5db2253380e47d775 originally added them. While qtversion.h is included in qglobal.h, using qtversion.h directly is a tiny step towards removing qglobal.h includes from our code-base, so don't let this opportunity go to waste. Change-Id: I28eaca1f4e250fc9e12e2ce6a6f94670a1d08dbe Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* a11y atspi: Bridge newly introduced QAccessibleSelectionInterfaceMichael Weghorn2022-11-132-0/+98
| | | | | | | | | | | | This bridges the newly introduced QAccessibleSelectionInterface to AT-SPI by exposing the AT-SPI Selection interface for objects implementing QAccessibleSelectionInterface and implementing the methods of the AT-SPI Selection interface. Fixes: QTBUG-105909 Change-Id: Ia05cef6c7dad8675ba8573f662f4338d301cf0e3 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* a11y: Add new QAccessibleSelectionInterfaceMichael Weghorn2022-11-113-2/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new QAccessibleSelectionInterface that implements support for handling selections, both retrieving information about the current selection as well as modifying the selection, thus providing the necessary foundation for exposing selections to assistive technology. This is similar to AT-SPI's Selection interface [1], but uses QAccessibleInterface pointers instead of child indices as parameters for methods. Bridging this newly introduced interface to AT-SPI will be done in a follow-up change. The concept for selection handling in Microsoft's UI Automation looks similar, so bridging this to the corresponding UIA interfaces ISelectionProvider [2], ISelectionItemProvider [3] and ISelectionProvider2 [4] should also be reasonably straightforward. At this point, this is only meant to be used for handling selection of direct children as is the concept in AT-SPI's Selection and presumably in UIA as well. (The ISelectionItemProvider and ISelectionProvider doc speaks of "child controls of containers" etc., but doesn't explicitly mention that this is only for direct children or whether grand children are also allowed.) (The proposed API itself could also be used to support selection of objects that are no direct children, but the practical use of that is unclear and it would make mapping/ bridging to platform a11y layers tricky.) [5] demonstrates a sample implementation of the QAccessibleSelectionInterface for the Qt-based UI variants of LibreOffice (screencast that shows the use of the interface attached to QTBUG-105909). This interface is marked \preliminary until: 1. There is a working a11y bridge for macOS/VoiceOver 2. There is a working a11y bridge for Windows/UI Automation 3. There is a working a11y bridge for linux/AT-SPI 4. There is at least one implementation (e.g. QAccessibleTable) that implements it successfully (second candidate: Qt Quick TableView [6]) [1] https://lazka.github.io/pgi-docs/Atspi-2.0/classes/Selection.html [2] https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iselectionprovider [3] https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iselectionitemprovider [4] https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iselectionprovider2 [5] https://gerrit.libreoffice.org/c/core/+/138750 [6] https://doc-snapshots.qt.io/qt6-dev/qml-qtquick-tableview.html [ChangeLog][QtGui][QAccessibleSelectionInterface] Added new preliminary QAccessibleSelectionInterface that can be used to expose selections to assistive technology. Task-number: QTBUG-105909 Change-Id: If77beacd94fa3eb663f0fbb2373f12382bab2ee3 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-034-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that the on() matcher has been replaced by one that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache, to avoid porting calls that explicitly test count(). Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* a11y atspi: Clean up logging a bitMichael Weghorn2022-10-261-26/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | Based on the discussion on logging style in the Gerrit change for commit 5145d3899d338fbb82a2d314c58eb60a4a5205f8 ("a11y atspi: Support AT-SPI table cell interface"), clean up the logging in AtSpiAdaptor a bit: * convert uses of qCDebug to qCWarning where the log message contained "WARNING"/"warning" or it seems worth that severity. * drop extra prefixes of "Qt AtSpiAdaptor:" in the log messages, since the logging category is already named "qt.accessibility.atspi" and only used here * more consistently start log messages with uppercase letter and drop unnecessary extra spaces The switch to qCWarning implies that these log messages are output by default. Change-Id: I1665a8ee8d64e4eab33a3b15906a7cb7357fd73c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* a11y: support GetAccessibleId for at-spiHarald Sitter2022-10-251-0/+26
| | | | | | | | | | | This introduces a new helper function accessibleIdForAccessible (inspired by Windows' automationIdForAccessible) to synthesize an id out of the objectNames of the accessible parent chain. The id is then exposed via the GetAccessibleId D-Bus function for consumption in a11y tools. Change-Id: If72b86c5864c43f4ca842aa11423dd8aea0dde4a Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
* Replace usages of Q_CLANG_QDOC with Q_QDOCLuca Di Sera2022-10-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | To allow the user to customize the C++ code that QDoc sees, so as to be able to work-around some limitations on QDoc itself, QDoc defines two symbols: Q_QDOC and Q_CLANG_QDOC, both of which are "true" during an entire execution of QDoc. At a certain point in time, QDoc allowed the user the choice between a custom C++ parser and a Clang based one. The Q_QDOC symbol would always be defined while the Q_CLANG_QDOC symbol would be defined only when the Clang based parser was chosen. In more recent times, QDoc always uses a Clang based parser, such that both Q_CLANG_QDOC and Q_QDOC are always defined, making them equivalent. To avoid using different symbols, and the possible confusion and fragmentation that derives from it, all usages of Q_CLANG_QDOC are now replaced by the equivalent usages of Q_QDOC. Change-Id: I5810abb9ad1016a4c5bbea99acd03381b8514b3f Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Send string to Atspi DBus interface on name/description changedFushan Wen2022-10-101-4/+22
| | | | | | | | | | | | | | | | | Orca only accepts string or list type for object:property-change:accessible-name and object:property-change:accessible-description events. This fixes NameChanged and DescriptionChanged not being announced by Orca. This also adds check for accessible interface and will ignore events from invalid interfaces on name/description changed. See also: https://gitlab.gnome.org/GNOME/orca/-/issues/255 Pick-to: 6.4 6.2 Change-Id: Iaaa50678e7223951e0f3af99c5e04aa7458e4d0d Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-044-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Send string to Atspi DBus interface on value changed for comboboxesFushan Wen2022-09-291-1/+3
| | | | | | | | | | Orca only accepts string or list type for object:property-change:accessible-name events. This fixes NameChanged not being announced by Orca. Pick-to: 6.4 6.2 Change-Id: Ib30fed94aad70b98400deec5e31630b4f8c22e26 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtGui: Use isEmpty() to check for empty stringMate Barany2022-09-211-1/+1
| | | | | | | | | | | This commit addresses a comment from the review of QTBUG-98434. Use isEmpty() to check whether the string is empty or not. Task-number: QTBUG-103100 Change-Id: Ia7c298bc4436d974b0369e178a370764c1dbe051 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QtGui: Fix mismatches between string types and string literalsMate Barany2022-09-212-15/+15
| | | | | | | | | | | | This commit addresses some comments from the review of QTBUG-98434. Some strings were initialized with incorrect literal types - fix the mismatches between the string types and string literals. Task-number: QTBUG-103100 Change-Id: I5f9f8a2c1583c21711f7b9ff177917f20690b5a3 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* a11y: Fix QAccessibleTableInterface::selectedRows docMichael Weghorn2022-09-191-1/+1
| | | | | | | | | While QAccessibleTableInterface::selectedColumns returns the selected columns, QAccessibleTableInterface::selectedRows should return the selected rows. Change-Id: I0a4972e7c46536aa813d35512c02336cc1efb286 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* a11y: Fix typo in QAccessible::ObjectHide docMichael Weghorn2022-09-161-1/+1
| | | | | | | | | "obscured" is also what the doc uses for QWidget's visible property [1]. [1] https://doc.qt.io/qt-6/qwidget.html#visible-prop Change-Id: I0fc5a2672b8d6f43627763e01ffe7ebde17ac6e8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* a11y atspi: Forward table model change to AT-SPIMichael Weghorn2022-09-101-1/+64
| | | | | | | | | | | This adds handling for QAccessible::TableModelChanged by forwarding the events to AT-SPI, s.a. the list of AT-SPI events at [1]. [1] https://accessibility.linuxfoundation.org/a11yspecs/atspi/adoc/atspi-events.html Change-Id: I0a2b64caf96126b4827a03886ce4a73f98429b7f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* a11y atspi: Move comment to better placeMichael Weghorn2022-09-101-3/+3
| | | | | | | | | Move the comment about setting the ATSPI_STATE_MANAGES_DESCENDANTS state to the place where the state is actually set. Change-Id: Ia6956d36db86e935b4fab03b1892cf4e8a709c0f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* a11y atspi: Add null check in GetRowHeader handlingMichael Weghorn2022-09-051-3/+3
| | | | | | | | | | | | | | | Just like the GetColumnHeader case already does, check that the cell isn't nullptr before trying to retrieve the table cell interface from it. (Not doing so e.g. resulted in a crash with WIP branches of LibreOffice and Orca to make selected cells with a child index not fitting into 32 bit work, s.a. https://bugs.documentfoundation.org/show_bug.cgi?id=150683 ) Pick-to: 6.4 6.3 Change-Id: Idd55fd1f0c49b616c732ddb683814605a46ff319 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Move qVersion() from qglobal.h to qlibraryinfo.hSona Kurazyan2022-09-011-0/+1
| | | | | | | | | | | | | | | Since qVersion() might be called also from C code, disable the parts of qlibraryinfo.h that are relevant only for C++ code if __cplusplus is not defined. [ChangeLog][Potentially Source-Incompatible Changes] qVersion() is moved from qglobal.h to qlibraryinfo.h, '#include <QtCore/QLibraryInfo>' needs to be added where it's used. Task-number: QTBUG-99313 Change-Id: I3363ef3fa4073114e5151cb3a2a1e8282ad42a4d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* a11y: Don't reassign unique ID to other object right awayMichael Weghorn2022-08-301-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the case that a newly created and registered accessible interface gets removed again from the cache before another one gets registered, the next registered interface was previously assigned the same "unique ID" again, which e.g. breaks assistive technology when using caching with AT-SPI, since that relies on the assumption that the ID is actually unique for each object. (But here, the new object was using the same object path as the old one, so data from the old object would be used for the new one.) To prevent that from happening, increment the counter for the next ID to try at the end of QAccessibleCache::acquireId, so the next time the method gets called, it doesn't try again whether the same ID as used previously is available again. For consistency, also rename the variable used for the counter from lastUsedId to nextId. This also adds a corresponding test case. Fixes: QTBUG-105962 Pick-to: 6.4 Change-Id: Iddf4f3b35c57895bcfbb623a5377edf8344ab6c2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>