summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
Commit message (Collapse)AuthorAgeFilesLines
* QCocoaA(11)y: do not try to access an element if rowIndex == -1Timur Pocheptsov2024-01-251-1/+1
| | | | | | | | | | This ends up in out of bounds exception. Pick-to: 6.7 6.6 6.5 6.6.2 Fixes: QTBUG-120469 Fixes: QTBUG-121008 Change-Id: Id895f311bbb59a3734ecadd0d2472a4018332e16 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS a11y: rebuild table model if out-of-bounds cell is requestedVolker Hilsheimer2023-12-161-7/+34
| | | | | | | | | | | | | | | | | | | While it is the itemview's responsibility to keep the accessibility bridge updated about changes in the view's structure and size, we have experienced a number of assertions getting triggered when that wasn't done correctly. Instead of an assert (or hard crash in release builds), recreate the table representation in the accessibility bridge when a cell that is out-of-bounds for the current representation is requested. Emit a warning message to inform widget authors, and improve the debug message with information about the column count as well. Amends 52c2b82082b535123c0eecafe1ec1e4e4190df2a. Pick-to: 6.7 6.6 Change-Id: I19c20a932153268a5176d7378c485277088f10bf Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QComboBox: inform accessibility about model change before selectingVolker Hilsheimer2023-12-091-0/+11
| | | | | | | | | | | | | | | | | | | | | QComboBox implicitly selects the first item that gets inserted into the model. This happens in response to the model's rowInserted signal, at which point the item view might not have handled the rowInserted signal yet. Because of that, the view couldn't update the accessibility bridge, so informing accessibility about a row being selected that doens't exist in the bridge's representation of the table yet will result in data being out of sync, and depending on the bridge implementation trigger asserts. Fix this by explicitly updating the accessibility bridge before implicitly selecting the first row. Fixes: QTBUG-119526 Fixes: QTBUG-118585 Pick-to: 6.6 6.5 Change-Id: I2830c00751b3f18feb5d9252b23823c80229fed1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* platform plugins: use string view types moreAnton Kudryavtsev2023-10-081-1/+3
| | | | | | | Change-Id: I793cfff1afca6b98a672615e33a19f8210e429dd Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QAccessible: consistently respect rootIndex of item viewsVolker Hilsheimer2023-09-011-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Accessibility implementations rely on correct information about the model dimensions when operating on item views. An item view that has a root index set needs to report it's size based on the root index, rather than for the view's model directly. Pass the rootIndex to all calls to QAbstractItemModel::column/rowCount. Refactor the code to avoid excessive dereferencing of a QPointer, apply const and fix/improve coding style in touched lines. Emit a ModelReset notification when the root index changes, or (in the case of QListView) when the model column changes. Split long Q_ASSERTs into multiple lines to be able to better trace the exact reason for an assertion, and replace the assert with an early return of nil when it's plausible that a cached cell is no longer part of the view (i.e. because the root index changed). Add a test case that verifies that changing the root index changes the dimension of the view as reported through the accessibility interface. Pick-to: 6.6 6.5 Fixes: QTBUG-114423 Change-Id: I7897b79b2e1d10c789cc866b7f5c5dabdabe6770 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* a11y macOS: Report selection/Bridge QAccessibleSelectionInterfaceMichael Weghorn2023-07-081-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | On macOS, support NSAccessibilityProtocol's accessibilitySelectedChildren method [1] by retrieving the selected children via the QAccessibleSelectionInterface introduced in commit 9d16d5e2245c26e5746fd7609300b84a2a983457. This e.g. makes a "selected children" attribute show up in "UI Browser" [2] for the item views in the "interview" example (examples/widgets/itemviews/interview/interview.app/Contents/MacOS/interview) and that one has an array containing the selected items as value. Sample scenario: 1) run the interview example (examples/widgets/itemviews/interview/interview.app) 2) select "Item 1:0", "Item 2:0" and "Item 3:0" by left-clicking on "Item 1:0" in the left view, then shift+clicking on "Item 3:0". 3) start UI Browser and navigate to the "group (group 1)" element and check that the value of its "selected children" attribute is an array containing the three selected items [1] https://developer.apple.com/documentation/appkit/nsaccessibilityprotocol/1524672-accessibilityselectedchildren [2] https://latenightsw.com/freeware/ui-browser/ Change-Id: Ic62f7fa82f2d01341a1dbc5ade2bd02c3ff99d9f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Fix assertion in accessibility implementation for treeviewsVolker Hilsheimer2023-05-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In QAccessible's widget implementations, trees are treated as tables, with a rowCount implementation that is based on the view's current item content. That item content is the view's content, not the model's, and it changes when tree branches are expanded. The Cocoa bridge for accessibility allocates arrays of row data structures based on the rowCount implementation. Those data structures need to be invalidated and recreated when the view's content changes. To do that, emit an accessibility event for a model reset when laying out items changes the size of the view's item array. We don't know what changed during that layout process to makes this any more granular. Amends 11ae55e918082e8fdfc0c88c21049e877cc47b5b, but the problem with the data structure being stale and incorrect would have been there before that chain of changes optimizing. It didn't trigger an assert, but probably resulted in incorrect data being reported. To make trees testable, we need to actually expose them as AXOutline to the macOS accessibility framework. Until now, they have been treated like plain QWidget, e.g. AXGroup. This made them in practice in- accessible. With this change, VoiceOver works much better (although not perfeclty yet). Also remove an assert that could be triggered by an accessibility client asking for a cell for an invalid index (which can be reproduced by navigating around in a tree, following debug warnings from QAccessibleTree::indexFromLogical: invalid index). Pick-to: 6.5 Change-Id: I7650342aa0dcd7925a94ae6a36de5a0b344c467d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS Accessibility: flag all synthetic elements as unignoredVolker Hilsheimer2023-04-111-3/+4
| | | | | | | | | | | | | | | | This saves us a few more roundtrips. For rows and columns we could check if their accessibilityFrame instersects with the table and so ignore rows and columns that are outside of the view, but I'm observing weird corruptions in the list returned by NSAccessibilityUnignoredChildren when ignoring any objects. Task-number: QTBUG-34337 Pick-to: 6.5 Change-Id: Ia2d13fff463ff26abb39acfceafcfa0761171203 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* macOS Accessibility: Delay creation of table cell interfacesVolker Hilsheimer2023-04-111-18/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since macOS requires us to return an array with elements as the children of a table's row. And it might ask for the children of many rows. This is very costly, and results in a lot of QAccessibleInterface instances being created unnecessary. Instead, use unassociated QMacAccessibleElements as place holders for cells, and place them in the column array of the QMacAccessibleElement that represents the respective row. Those placeholder elements have the synthesizedRole set to AXCell, and have the same axid as the table, for as long as there is no corresponding QAccessibleTableCell created. Until that point, they are in practice "managedByParent" just as the row and column elements. Since the place holder object knows about its column, row, and table, it can respond to many inquiries directly without needing to create the interface. Once the QAccessibleInterface for the cell is required for an already existing place holder, then we need to promote the place holder to an independent element. We reset the synthesizedRole to nil, and change the axid to the ID of the cell interface. However, the cell interface might have been created and assocated with an element before the placeholders were created when navigating through the children of a row. So when we create an element for a table cell, then we need to make sure that the table elements' corresponding row is also populated, with the new element in the right place. Pick-to: 6.5 Fixes: QTBUG-34337 Change-Id: Iff78e3b8335df8cf294fffb6579605bfeb8409ed Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS Accessibility: don't create an unnecessary interfaceVolker Hilsheimer2023-04-111-6/+3
| | | | | | | | | | We only need to compare elements to determine whether this element has focus. Task-number: QTBUG-34337 Pick-to: 6.5 Change-Id: Ic1388ac00381735acfbf1e5877a658f4bd534dfb Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS Accessibility: add an elementWithInterface helperVolker Hilsheimer2023-04-111-12/+16
| | | | | | | | | | | | | | | Instead of explicitly creating an ID from an interface and then asking for the element for the ID, ask for the element for the interface directly. In that helper we can also make sure that the created element is correctly configured if the interface for which it was created was for a table cell. Task-number: QTBUG-34337 Pick-to: 6.5 Change-Id: Id0f9247b0b50195301b293dcabb8925c3fc2d2cf Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS Accessibility: optimize table interface implementationVolker Hilsheimer2023-04-111-42/+57
| | | | | | | | | | | | | | Store row and column in the QMacAccessibilityElement when creating it so that we can avoid linearly looking for ourselves in the parent's data. Row elements have their m_rowIndex set, Column elements the m_columnIndex, and elements representing a cell have both set. Cells are not managed by the table. Task-number: QTBUG-34337 Pick-to: 6.5 Change-Id: I319fad1f1fda0cfa4c0b95e9e16c25c87df04351 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS Accessibility: code hygieneVolker Hilsheimer2023-04-111-130/+103
| | | | | | | | | | | | | | Make getting a QAccessibleInterface from a QMacAccessibilityElement a member function that also tests for the validity of the interface, and replace the respective code duplication. Remove unused member functions accessibilityMin/MaxValue. Task-number: QTBUG-34337 Pick-to: 6.5 Change-Id: Ie15cf0b71285e63cc485d87ced050dc541967c98 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* a11y: Add support for Tables in macOS bridgeJan Arve Sæther2022-11-101-2/+255
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For a11y purposes, a table needs to be mapped into a logical accessibility hierarchy. There are several ways of doing this mapping, and unfortunately macOS expects something different than what QAccessibleInterface does. So suppose we have a a 2x2 QTableView with both horizontal and vertical header like this (the names reflect the QAccessible::Role names): +-----------+--------------+--------------+ | | ColumnHeader | ColumnHeader | +-----------+--------------+--------------+ | RowHeader | Cell | Cell | +-----------+--------------+--------------+ | RowHeader | Cell | Cell | +-----------+--------------+--------------+ In order to be presented to the screen reader on a platform, it goes through two rounds of mapping: QAccessibleInterface will have all headers and cells as direct children of the table: - Table +- ColumnHeader +- ColumnHeader +- RowHeader +- Cell +- Cell +- RowHeader +- Cell +- Cell macOS expects a deeper hierarchy: - AXTable [QAccessible::Table] +- AXRow [Qt:no eqiuivalent] +- [QAccessible::Cell] (The content of the cell, e.g. AXButton, AXGroup or whatever) +- [QAccessible::Cell] (The content of the cell, e.g. AXButton, AXGroup or whatever) +- AXRow +- [QAccessible::Cell] (The content of the cell, e.g. AXButton, AXGroup or whatever) +- [QAccessible::Cell] (The content of the cell, e.g. AXButton, AXGroup or whatever) +- AXColumn (this seems to just store the geometry of the column) +- AXColumn (this seems to just store the geometry of the column) +- AXGroup (this represents the column headers) +- AXSortButton (clicking a header cell will trigger sorting) +- AXSortButton (clicking a header cell will trigger sorting) It's unclear to me how RowHeaders are mapped (they are rarer than ColumnHeaders, I expect to find them in e.g. spreadsheet applications). I haven't found any native usage of them. So this patch simply ignores them. Notice that macOS have a three layer deep hierarchy to represent a table (Table->Row->Cell), while QAccessibleInterface has a two-layer deep hierarchy (Table->Row/Cell). In the macOS bridge we therefore need to "inject" the Row/Column element to be "between" the table and the cell. The table will take ownership of all row and column elements that are children of the table. These elements are not inserted into the cache (it would be pointless, since the cache is basically just a mapping between the QAccessibleInterface -> QMacAccessibilityElement, and the row and column elements does not have a corresponding QAccessibleInterface to be mapped from). The rows and columns are therefore also created as soon as the table element is initialized, and they are stored in two NSMutableArray members of QMacAccessibilityElement. A table is constructed like any other accessibility element, with a valid axid and synthesizedRole set to nil. Each child row and column element is constructed with the same axid as the parent table element, and they will have the synthesizedRole set to either NSAccessibilityRow or NSAccessibilityColumn. With the synthesizedRole member we can then identify if we are a row, column or the actual table, and implement their respective behaviors. Notice that the child row/column is created with the parent's table axid in order for them to have a way of finding their parent table element. (there is no 'parent' member variable in QMacAccessibilityElement) This glorious scheme isn't pretty, but seems to work. Fixes: QTBUG-37207 Change-Id: I7c2451e629f5331b9a0ed61dc22c6e74a82cc173 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Replace QT_NO_ACCESSIBILITY with QT_CONFIG(accessibility)Allan Sandfeld Jensen2022-06-151-2/+2
| | | | | | | Pick-to: 6.4 Change-Id: Iee4bd8970810be1b23bdba65a74de912401dca65 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Plugins: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-05-021-1/+1
| | | | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: Id76add7e86b6dfb89f758a9efb0644067f0f44de Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Update deprecated NSAccessibility methodVolker Hilsheimer2021-07-211-1/+1
| | | | | | | | | | | accessibilityEnabledAttribute is replaced with isAccessibilityEnabled. https://developer.apple.com/documentation/appkit/nsaccessibility/1535024-accessibilityenabled?language=objc Fixes: QTBUG-95293 Pick-to: 6.2 6.1 5.15 Change-Id: Ie88fa61ad97d6c77dcec15e63a73f64c90011497 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Port platform plugins to QStringViewLars Knoll2020-06-151-1/+1
| | | | | | Task-number: QTBUG-84319 Change-Id: If409ba1c99f30c7ab32c7cc826c7f303ccf18c1d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* a11y: Implement accessibilityHelp on macOSJan Arve Sæther2020-06-151-0/+10
| | | | | | | | | Note for manual testing: You can read it manually with vo+shift+h Fixes: QTBUG-84864 Pick-to: 5.15 Change-Id: I5686e40642396db2fde685cf07b758acd29c6ee0 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* macOS: Clean up headersTor Arne Vestbø2020-06-051-2/+3
| | | | | | | | | | | | | | The headers are now C++ clean and can be used outside of Objective-C code. All includes of Objective-C frameworks have been moved to the implementation files. Header guards have been added in the few places they were missing. All includes are now done via #include, instead of sometimes using the #import variant. Change-Id: Ibb0a9c0bcfefbda4347737212e40e300a3184982 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Move QtAccessibilitySupport into QtGuiTor Arne Vestbø2020-06-021-1/+1
| | | | | | Task-number: QTBUG-83255 Change-Id: Ibc1b38e77c3c90030a832c41f4de65c6c38bc91d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: Clean up header includes to use quotes or brackets as appropriateTor Arne Vestbø2020-04-151-1/+2
| | | | | | | | The includes can be sorted and unified even more, but that's left for another rainy day. Change-Id: I4d5670d6d8389f69d2631b83b8f421d1f685a0f9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Replace foreach with ranged for loopsTor Arne Vestbø2020-04-141-1/+1
| | | | | Change-Id: I9d0dbb60e05e4ef85219740465bb941ef8d8eb0f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* macOS: Fix usage of deprecated accessibility APIsFrederik Gladhorn2019-05-201-124/+119
| | | | | | | | | | | | | | | The accessibilityAttributeValue method was deprecated and all needed replacements are in macOS 10.12. The new API is nicer, since it adds a lot of individual functions instead of forcing one big switch statement on us. This makes it easier to implement further protocols. When implementing e.g. the Button protocol, the old attribute functions do not get called any more, so this is needed before implementing more features. Change-Id: I5a705edfa3f6bb0d25436df8cf5dd7f59e7e764e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS accessibility: implement accessibilityLabelFrederik Gladhorn2019-05-161-1/+17
| | | | | | | | | | We had an implementation of this based on the old attribute based API, which also works. This cleans it up and adds the setter. Change-Id: I886fc9c89ee08b9f4f9aabec00ac1a5b9a800c6f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS accessibility: Implement NSAccessibilityElementFrederik Gladhorn2019-05-151-3/+12
| | | | | | | | | | | Modern macOS accessibility is based on protocols. By implementing NSAccessibilityElement we get warnings for missing functions for the most basic accessibility functionality. Change-Id: I0595ea5b9927c5bfb4bbeff3fc9322cb1f232b9f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Merge remote-tracking branch 'origin/5.12' into 5.13Liang Qi2019-02-081-6/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/android/templates/AndroidManifest.xml src/network/ssl/qsslsocket_mac.cpp src/widgets/styles/qstylesheetstyle.cpp tests/auto/corelib/kernel/qtimer/BLACKLIST tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp tests/auto/testlib/selftests/expected_blacklisted.lightxml tests/auto/testlib/selftests/expected_blacklisted.tap tests/auto/testlib/selftests/expected_blacklisted.teamcity tests/auto/testlib/selftests/expected_blacklisted.txt tests/auto/testlib/selftests/expected_blacklisted.xml tests/auto/testlib/selftests/expected_blacklisted.xunitxml tests/auto/testlib/selftests/expected_float.tap tests/auto/testlib/selftests/expected_float.teamcity tests/auto/testlib/selftests/expected_float.txt tests/auto/testlib/selftests/expected_float.xunitxml Done-With: Christian Ehrlicher <ch.ehrlicher@gmx.de> Done-With: Edward Welbourne <edward.welbourne@qt.io> Done-With: Timur Pocheptsov <timur.pocheptsov@qt.io> Change-Id: If93cc432a56ae3ac1b6533d0028e4dc497415a52
| * Cocoa: Don’t cache accessibility roleMorten Johan Sørvig2019-01-291-6/+3
| | | | | | | | | | | | | | | | | | | | | | The object role may in some cases (e.g. when using Qt Quick Loaders) be changed after construction, and we don’t have RoleChanged events. Change-Id: Idb246c1c1206221cacd93c83cbd07a0e3d98cb0e Fixes: QTBUG-72967 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | macOS accessibility: Implement accessibilityFrameFrederik Gladhorn2018-12-121-0/+7
| | | | | | | | | | | | Change-Id: Id78d3826eb18ff5ca306ac190543a7ff37b2f014 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | macOS accessibility: Rename parentElement to accessibilityParentFrederik Gladhorn2018-12-061-7/+6
| | | | | | | | | | | | | | | | | | The NSAccessibility protocol has a property accessibilityParent. This adds the implementation. The protocol will be adopted in a follow-up commit. Change-Id: I648cdc201950159e8268743a7fcdd24beb58c1c6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-11-271-2/+3
|\| | | | | | | Change-Id: I04afffdce6b78856d0301eb583f21d334c7466b0
| * macOS accessibility: fix crash for NSAccessibilityVisibleCharacterRangeAttributeFrederik Gladhorn2018-11-231-2/+3
| | | | | | | | | | | | | | | | | | VoiceOver or other tools may query this property even when there is no text interface. Make sure not to crash by verifying that the interface is supported. Found while using AccessibilityInspector to verify other changes. Change-Id: If7ee21b7616f091b71e86bab03a871ddbabe9200 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | macOS a11y: Implement AXInsertionPointLineNumber with AXLineForIndexBoris Dušek2018-11-231-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow DRY and do not repeat implementation of basically the same thing, especially now that the implementation is no longer completely trivial. AXLineForIndex can be considered a primitive attribute, and AXInsertionPointLineNumber a derived attribute, hence this opportunity to not repeat oneself. Change-Id: I64b596d8351e681f4438b91400a767407612c118 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Align implementation of LineForIndex with InsertionPointLineNumberBoris Dušek2018-11-231-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | On macOS, the accessibility implementation of InsertionPointLineNumber currently reflects a fix for issue (QTBUG-49437). While it seems from testing this issue no longer requires such a fix, it still is a nice optimization for single-line edits. So we hereby bring the same optimization to LineForIndex parameterized attribute as well, and makes the code for both attributes consistent. Change-Id: I18b8cc249b6c65a25150f4e503999b04437e0306 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | qcocoaaccessibilityelement.mm: Document convertLineOffset functionBoris Dušek2018-11-231-0/+13
| | | | | | | | | | | | Change-Id: I359768a7cbd4c3e1e11a453a32bb28add891cf20 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Fix VoiceOver interaction with multiline text componentsBoris Dušek2018-11-231-0/+1
|/ | | | | | | | | | | | | `convertLineOffset` requires exactly one of `line` and `offset` parameters to be -1. [ChangeLog][macOS][Accessibility] VoiceOver now reads all lines in multiline text components when navigating by lines. Change-Id: I2872c4f5255a33dd2b493b46b22e672eb5779ee8 Fixes: QTBUG-71563 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Cocoa QPA: Clean up 0 as pointerGabriel de Dietrich2018-04-191-1/+1
| | | | | | | | We use nil for Objective-C null pointers and nullptr everywhere else, including CoreFoundation and similar opaque types. Change-Id: Id75c59413dec54bf4d8e83cf7ed0ff7f3d8bb480 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Clean up our Objective-C usageJake Petroules2018-02-201-44/+40
| | | | | | | | | | | | | | | | - Move ivars into @implementation - Use instancetype where applicable - Use dot notation for property access - Use subscript operator for dictionaries and arrays - Format selectors consistently - Use proper style for init methods - Use generics instead of void pointers where possible - Use "range for" loops instead of indexing - Replace or replace IBAction/IBOutlet with void Change-Id: I1667812a51d4dfe44ae80fe337cb1f4bc9699d92 Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: Simplify helpers for flipping between quadrant I and IVTor Arne Vestbø2017-11-081-10/+10
| | | | | | | | | | | | The different flip-functions have been replaced by a single function, qt_mac_flip, with overloads for points and rects. This function is primarily used to implement QCocoaScreen::map(To|From)Native, which most clients of qt_flip* have been moved to. This makes it clearer what kind of reference geometry we're flipping in relation to, and simplifies call-sites. Change-Id: I8a0862f94bb2c64a83a1c3168f984a195c0af6db Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Cocoa: Clean up memory leak when providing the accessibilityActionsAndy Shaw2017-05-231-1/+1
| | | | | Change-Id: Ib69155ceedb7bf35e3a7b5daa309fc2d54e3f254 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Fix regression preventing VoiceOver following the keyboard focusFrederik Gladhorn2017-02-071-2/+9
| | | | | | | | | | | | In fafdb171e0c317ee8f871dc7b504d3713d5860eb a potential nullptr deref was fixed, but it changed the hierarchy of accessible objects. The new hierarchy would prefer to send a parent object that represents the application, but macOS needs the window to be in the hierarchy for VoiceOver to behave as expected. Tweak it so that we give the window as parent again, not the app. Change-Id: I5f7f59b07d0966c8bcf96968e4ed65eba9e05be6 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Accessibility macOS: check for valid interfacesFrederik Gladhorn2017-01-051-5/+5
| | | | | | | | There are a few places that did not check if the returned interface is valid. Task-number: QTBUG-52536 Change-Id: I56ca0952fec0b44dfd4b3991aa94554e9c829642 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Accessibility macOS: fix parentElementFrederik Gladhorn2017-01-051-10/+10
| | | | | | | | | | | | | | Try to return the immediate parent first, nothing else makes sense. The original code relied on the window pointer usually being nullptr, which is not reliable. Make sure to check the validity of the handle returned, since it's possible to have the platform window being nullptr. It's not quite clear to me how to end up with a null window though. Task-number: QTBUG-52304 Change-Id: Id3e70cdab980fb0a86cebbb7c10d824d8a7dd80b Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* port to modularized platformsupport librariesOswald Buddenhagen2016-10-151-1/+1
| | | | | Change-Id: I20eb0e33abfd70b6a5240e7b6b0aa0425f2d2ee7 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* macOS: Get rid of m_qtView member in QCocoaWindow that aliased m_viewTor Arne Vestbø2016-10-101-1/+1
| | | | | | | | | | | | | The member was mirroring m_view in all cases except for foreign windows. Instead of a member we now check window()->type() != Qt::ForeignWindow, which is more explicit, especially for people not normally working on the macOS platform. To call methods that are only implemented for our QNSView subclass, a new qnsview_cast() function has been introduced. Change-Id: I0a2cfe1a5e4502250c17e1c3ebdce19e9ee5e572 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Replace QCFString::to(CF/NS/Q)String usage with QString methodsTor Arne Vestbø2016-10-061-4/+4
| | | | | | | | Slims down QCFString and leaves only one implementation of converting back and forth between CF/NS strings and QStrings. Change-Id: I068568ffa25e6f4f6d6c99dcf47078b7a8e70e10 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* QtBase (remainder): use printf-style qWarning/qDebug where possible (I)Marc Mutz2016-03-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "" with qWarning("..."). Had to fix broken qImDebug() definition. Instead of defining it as a nullary macro in the QT_NO_DEBUG case and as a variadic macro in the other, define it in both cases, as is customary, as a non-function macro so that overload selection works without requiring variadic macro support of the compiler. Saves e.g. ~250b in text size in QtPrintSupport on optimized GCC 5.3 AMD64 builds. Change-Id: Ie30fe2f7942115d5dbf99fff1750ae0d477c379f Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-181-13/+15
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also reverts commit 018e670a26ff5a61b949100ae080f5e654e7bee8. The change was introduced in 5.6. After the refactoring, 14960f52, in 5.7 branch and a merge, it is not needed any more. Conflicts: .qmake.conf src/corelib/io/qstandardpaths_mac.mm src/corelib/tools/qsharedpointer_impl.h tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp Change-Id: If4fdff0ebf2b9b5df9f9db93ea0022d5ee3da2a4
| * Accessibility OS X: Fix hang when editing password line editsFrederik Gladhorn2016-01-281-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a regression when entering data in a password field. The important part is to simply not call convertLineOffset for single line text edits. The reason is that the function when dealing with password fields gets an empty string back when calling textAt etc. This is good since we don't want to leak passwords through a11y apis. The problem with the functions returning empty strings is that we end up in an infinite loop in convertLineOffset. Task-number: QTBUG-49437 Change-Id: I76faa7e33e3ad5c3aeb5c75d8c4b93f1b8227bfc Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>