5#include <QtGui/qtguiglobal.h>
6#if QT_CONFIG(accessibility)
8#include "qwindowsuiarangevalueprovider.h"
9#include "qwindowsuiautils.h"
10#include "qwindowscontext.h"
12#include <QtGui/qaccessible.h>
13#include <QtCore/qloggingcategory.h>
14#include <QtCore/qstring.h>
18using namespace QWindowsUiAutomation;
21QWindowsUiaRangeValueProvider::QWindowsUiaRangeValueProvider(QAccessible::Id id) :
22 QWindowsUiaBaseProvider(id)
26QWindowsUiaRangeValueProvider::~QWindowsUiaRangeValueProvider()
30HRESULT STDMETHODCALLTYPE QWindowsUiaRangeValueProvider::SetValue(
double val)
32 qCDebug(lcQpaUiAutomation) <<
__FUNCTION__;
34 QAccessibleInterface *accessible = accessibleInterface();
36 return UIA_E_ELEMENTNOTAVAILABLE;
38 QAccessibleValueInterface *valueInterface = accessible->valueInterface();
40 return UIA_E_ELEMENTNOTAVAILABLE;
42 double minimum = valueInterface->minimumValue().toDouble();
43 double maximum = valueInterface->maximumValue().toDouble();
44 if ((val < minimum) || (val > maximum))
47 valueInterface->setCurrentValue(QVariant(val));
51HRESULT STDMETHODCALLTYPE QWindowsUiaRangeValueProvider::get_Value(
double *pRetVal)
53 qCDebug(lcQpaUiAutomation) <<
__FUNCTION__;
58 QAccessibleInterface *accessible = accessibleInterface();
60 return UIA_E_ELEMENTNOTAVAILABLE;
62 QAccessibleValueInterface *valueInterface = accessible->valueInterface();
64 return UIA_E_ELEMENTNOTAVAILABLE;
66 QVariant varValue = valueInterface->currentValue();
67 *pRetVal = varValue.toDouble();
71HRESULT STDMETHODCALLTYPE QWindowsUiaRangeValueProvider::get_IsReadOnly(BOOL *pRetVal)
73 qCDebug(lcQpaUiAutomation) <<
__FUNCTION__;
78 QAccessibleInterface *accessible = accessibleInterface();
80 return UIA_E_ELEMENTNOTAVAILABLE;
82 *pRetVal = accessible->state().readOnly;
86HRESULT STDMETHODCALLTYPE QWindowsUiaRangeValueProvider::get_Maximum(
double *pRetVal)
88 qCDebug(lcQpaUiAutomation) <<
__FUNCTION__;
93 QAccessibleInterface *accessible = accessibleInterface();
95 return UIA_E_ELEMENTNOTAVAILABLE;
97 QAccessibleValueInterface *valueInterface = accessible->valueInterface();
99 return UIA_E_ELEMENTNOTAVAILABLE;
101 QVariant varValue = valueInterface->maximumValue();
102 *pRetVal = varValue.toDouble();
106HRESULT STDMETHODCALLTYPE QWindowsUiaRangeValueProvider::get_Minimum(
double *pRetVal)
108 qCDebug(lcQpaUiAutomation) <<
__FUNCTION__;
113 QAccessibleInterface *accessible = accessibleInterface();
115 return UIA_E_ELEMENTNOTAVAILABLE;
117 QAccessibleValueInterface *valueInterface = accessible->valueInterface();
119 return UIA_E_ELEMENTNOTAVAILABLE;
121 QVariant varValue = valueInterface->minimumValue();
122 *pRetVal = varValue.toDouble();
126HRESULT STDMETHODCALLTYPE QWindowsUiaRangeValueProvider::get_LargeChange(
double *pRetVal)
128 qCDebug(lcQpaUiAutomation) <<
__FUNCTION__;
129 return get_SmallChange(pRetVal);
132HRESULT STDMETHODCALLTYPE QWindowsUiaRangeValueProvider::get_SmallChange(
double *pRetVal)
134 qCDebug(lcQpaUiAutomation) <<
__FUNCTION__;
139 QAccessibleInterface *accessible = accessibleInterface();
141 return UIA_E_ELEMENTNOTAVAILABLE;
143 QAccessibleValueInterface *valueInterface = accessible->valueInterface();
145 return UIA_E_ELEMENTNOTAVAILABLE;
147 QVariant varValue = valueInterface->minimumStepSize();
148 *pRetVal = varValue.toDouble();