4#include <QtGui/qtguiglobal.h>
5#if QT_CONFIG(accessibility)
11#include <QtGui/qaccessible.h>
12#include <QtCore/qloggingcategory.h>
13#include <QtCore/qstring.h>
17using namespace QWindowsUiAutomation;
19static bool isExpanded(QAccessibleInterface *accessible)
22 if (accessible->role() == QAccessible::MenuItem)
23 return accessible->childCount() > 0 && !accessible->child(0)->state().invisible;
25 return accessible->state().expandable && accessible->state().expanded;
28QWindowsUiaExpandCollapseProvider::QWindowsUiaExpandCollapseProvider(QAccessible::Id
id) :
29 QWindowsUiaBaseProvider(
id)
33QWindowsUiaExpandCollapseProvider::~QWindowsUiaExpandCollapseProvider() =
default;
35HRESULT STDMETHODCALLTYPE QWindowsUiaExpandCollapseProvider::Expand()
37 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
39 QAccessibleInterface *accessible = accessibleInterface();
41 return UIA_E_ELEMENTNOTAVAILABLE;
43 QAccessibleActionInterface *actionInterface = accessible->actionInterface();
45 return UIA_E_ELEMENTNOTAVAILABLE;
47 if (!isExpanded(accessible))
48 actionInterface->doAction(QAccessibleActionInterface::showMenuAction());
53HRESULT STDMETHODCALLTYPE QWindowsUiaExpandCollapseProvider::Collapse()
55 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
57 QAccessibleInterface *accessible = accessibleInterface();
59 return UIA_E_ELEMENTNOTAVAILABLE;
61 QAccessibleActionInterface *actionInterface = accessible->actionInterface();
63 return UIA_E_ELEMENTNOTAVAILABLE;
65 if (isExpanded(accessible))
66 actionInterface->doAction(QAccessibleActionInterface::showMenuAction());
71HRESULT STDMETHODCALLTYPE QWindowsUiaExpandCollapseProvider::get_ExpandCollapseState(__RPC__out ExpandCollapseState *pRetVal)
73 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
77 *pRetVal = ExpandCollapseState_LeafNode;
79 QAccessibleInterface *accessible = accessibleInterface();
81 return UIA_E_ELEMENTNOTAVAILABLE;
83 *pRetVal = isExpanded(accessible) ? ExpandCollapseState_Expanded : ExpandCollapseState_Collapsed;
Combined button and popup list for selecting options.
#define qCDebug(category,...)