Bridge QAccessibleSelectionInterface that was introduced
in commit 9d16d5e224 to
UIA's ISelectionProvider and ISelectionProvider2 interfaces
by extending the existing WindowsUiaSelectionProvider
to make use of the QAccessibleSelectionInterface.
Also make use of that interface to implement handling
for the ISelectionProviderItem interface methods when
an object has a parent that implements the
QAccessibleSelectionInterface.
Sample use from NVDA's Python console [1] with this
commit in place:
1) start NVDA
2) run the interview example (examples\widgets\itemviews\interview\interview.exe)
3) 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".
4) press Numpad_insert+control+z to start the NVDA Python console and
capture snapshot variables
5) query and use the interfaces using NVDA's Python console:
>>> import UIAHandler
>>> selectionpattern2 = focus.parent.UIAElement.GetCurrentPattern(10034).QueryInterface(UIAHandler.IUIAutomationSelectionPattern2)
>>> selectionpattern2.CurrentFirstSelectedItem.CurrentName
'Item 1:0'
>>> selectionpattern2.CurrentLastSelectedItem.CurrentName
'Item 3:0'
>>> selectionpattern2.CurrentItemCount
3
>>> selectionitempattern = focus.UIAElement.GetCurrentPattern(10010).QueryInterface(UIAHandler.IUIAutomationSelectionItemPattern)
>>> selectionitempattern.CurrentIsSelected
1
>>> selectionitempattern.RemoveFromSelection()
0
>>> selectionitempattern.CurrentIsSelected
0
>>> selectionpattern2.CurrentItemCount
2
>>> selectionitempattern.Select()
0
>>> selectionitempattern.CurrentIsSelected
1
(Note that calling selectionitempattern.AddToSelection
in that example would also unselect all other currently
selected entries, because the underlying implementation
has a selection mode of QAbstractItemView::SingleSelection
set in QAccessibleTree::selectRow, which gets called
from QAccessibleTable::select via QAccessibleTableCell::selectCell.)
[1] https://www.nvaccess.org/files/nvda/documentation/developerGuide.html#PythonConsole
Change-Id: I7003bae5bbcfd5c685620bf710781165ed70f106
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>