本文整理汇总了C++中QAccessibleInterface::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ QAccessibleInterface::isValid方法的具体用法?C++ QAccessibleInterface::isValid怎么用?C++ QAccessibleInterface::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAccessibleInterface
的用法示例。
在下文中一共展示了QAccessibleInterface::isValid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: accHitTest
/*
IAccessible
*/
HRESULT STDMETHODCALLTYPE QWindowsAccessible::accHitTest(long xLeft, long yTop, VARIANT *pvarID)
{
showDebug(__FUNCTION__, accessible);
if (!accessible->isValid())
return E_FAIL;
int control = accessible->childAt(xLeft, yTop);
if (control == -1) {
(*pvarID).vt = VT_EMPTY;
return S_FALSE;
}
QAccessibleInterface *acc = 0;
if (control)
accessible->navigate(Child, control, &acc);
if (!acc) {
(*pvarID).vt = VT_I4;
(*pvarID).lVal = control;
return S_OK;
}
QWindowsAccessible* wacc = new QWindowsAccessible(acc);
IDispatch *iface = 0;
wacc->QueryInterface(IID_IDispatch, (void**)&iface);
if (iface) {
(*pvarID).vt = VT_DISPATCH;
(*pvarID).pdispVal = iface;
return S_OK;
} else {
delete wacc;
}
(*pvarID).vt = VT_EMPTY;
return S_FALSE;
}
示例2: get_accDescription
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accDescription(VARIANT varID, BSTR* pszDescription)
{
QAccessibleInterface *accessible = accessibleInterface();
accessibleDebugClientCalls(accessible);
if (!accessible)
return E_FAIL;
QString descr;
if (varID.lVal) {
QAccessibleInterface *child = childPointer(accessible, varID);
if (!child || !child->isValid())
return E_FAIL;
descr = child->text(QAccessible::Description);
} else {
descr = accessible->text(QAccessible::Description);
}
if (descr.size()) {
*pszDescription = QStringToBSTR(descr);
return S_OK;
}
*pszDescription = 0;
return S_FALSE;
}
示例3: get_accValue
// moz: [important]
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accValue(VARIANT varID, BSTR* pszValue)
{
QAccessibleInterface *accessible = accessibleInterface();
accessibleDebugClientCalls(accessible);
if (varID.vt != VT_I4)
return E_INVALIDARG;
if (!accessible || !accessible->isValid() || varID.lVal) {
return E_FAIL;
}
QString value;
if (accessible->valueInterface()) {
value = QString::number(accessible->valueInterface()->currentValue().toDouble());
} else {
value = accessible->text(QAccessible::Value);
}
if (!value.isNull()) {
*pszValue = QStringToBSTR(value);
return S_OK;
}
*pszValue = 0;
accessibleDebug("return S_FALSE");
return S_FALSE;
}
示例4: accSelect
HRESULT STDMETHODCALLTYPE QWindowsAccessible::accSelect(long flagsSelect, VARIANT varID)
{
#ifdef DEBUG_SHOW_ATCLIENT_COMMANDS
showDebug(__FUNCTION__, accessible);
#endif //DEBUG_SHOW_ATCLIENT_COMMANDS
if (!accessible->isValid())
return E_FAIL;
bool res = false;
if (flagsSelect & SELFLAG_TAKEFOCUS)
res = accessible->doAction(SetFocus, varID.lVal, QVariantList());
if (flagsSelect & SELFLAG_TAKESELECTION) {
accessible->doAction(ClearSelection, 0, QVariantList());
res = accessible->doAction(AddToSelection, varID.lVal, QVariantList());
}
if (flagsSelect & SELFLAG_EXTENDSELECTION)
res = accessible->doAction(ExtendSelection, varID.lVal, QVariantList());
if (flagsSelect & SELFLAG_ADDSELECTION)
res = accessible->doAction(AddToSelection, varID.lVal, QVariantList());
if (flagsSelect & SELFLAG_REMOVESELECTION)
res = accessible->doAction(RemoveSelection, varID.lVal, QVariantList());
return res ? S_OK : S_FALSE;
}
示例5: get_accRole
// moz: [important]
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accRole(VARIANT varID, VARIANT *pvarRole)
{
QAccessibleInterface *accessible = accessibleInterface();
accessibleDebugClientCalls(accessible);
if (!accessible)
return E_FAIL;
QAccessible::Role role;
if (varID.lVal) {
QAccessibleInterface *child = childPointer(accessible, varID);
if (!child || !child->isValid())
return E_FAIL;
role = child->role();
} else {
role = accessible->role();
}
if (role != QAccessible::NoRole) {
if (role >= QAccessible::LayeredPane) {
// This block should hopefully only be entered if the AT client
// does not support IAccessible2, since it should prefer IA2::role() then.
if (role == QAccessible::LayeredPane)
role = QAccessible::Pane;
else if (role == QAccessible::WebDocument)
role = QAccessible::Document;
else
role = QAccessible::Client;
}
(*pvarRole).vt = VT_I4;
(*pvarRole).lVal = role;
} else {
(*pvarRole).vt = VT_EMPTY;
}
return S_OK;
}
示例6: get_accChild
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accChild(VARIANT varChildID, IDispatch** ppdispChild)
{
showDebug(__FUNCTION__, accessible);
if (!accessible->isValid())
return E_FAIL;
if (varChildID.vt == VT_EMPTY)
return E_INVALIDARG;
int childIndex = varChildID.lVal;
QAccessibleInterface *acc = 0;
AccessibleElement elem(childIndex, accessible);
if (elem.iface) {
RelationFlag rel = elem.entry ? Child : Self;
int index = elem.iface->navigate(rel, elem.entry, &acc);
if (index == -1)
return E_INVALIDARG;
}
if (acc) {
QWindowsAccessible* wacc = new QWindowsAccessible(acc);
wacc->QueryInterface(IID_IDispatch, (void**)ppdispChild);
return S_OK;
}
*ppdispChild = 0;
return S_FALSE;
}
示例7: accSelect
HRESULT STDMETHODCALLTYPE QWindowsAccessible::accSelect(long flagsSelect, VARIANT varID)
{
showDebug(__FUNCTION__, accessible);
if (!accessible->isValid())
return E_FAIL;
bool res = false;
AccessibleElement elem(varID.lVal, accessible);
QAccessibleInterface *acc = elem.iface;
if (acc) {
const int entry = elem.entry;
if (flagsSelect & SELFLAG_TAKEFOCUS)
res = acc->doAction(SetFocus, entry, QVariantList());
if (flagsSelect & SELFLAG_TAKESELECTION) {
acc->doAction(ClearSelection, 0, QVariantList()); //### bug, 0 should be entry??
res = acc->doAction(AddToSelection, entry, QVariantList());
}
if (flagsSelect & SELFLAG_EXTENDSELECTION)
res = acc->doAction(ExtendSelection, entry, QVariantList());
if (flagsSelect & SELFLAG_ADDSELECTION)
res = acc->doAction(AddToSelection, entry, QVariantList());
if (flagsSelect & SELFLAG_REMOVESELECTION)
res = acc->doAction(RemoveSelection, entry, QVariantList());
}
return res ? S_OK : S_FALSE;
}
示例8: accDoDefaultAction
/*
Properties and methods
*/
HRESULT STDMETHODCALLTYPE QWindowsAccessible::accDoDefaultAction(VARIANT varID)
{
showDebug(__FUNCTION__, accessible);
if (!accessible->isValid())
return E_FAIL;
AccessibleElement elem(varID.lVal, accessible);
const bool res = elem.iface ? elem.iface->doAction(DefaultAction, elem.entry, QVariantList()) : false;
return res ? S_OK : S_FALSE;
}
示例9: accDoDefaultAction
/*
Properties and methods
*/
HRESULT STDMETHODCALLTYPE QWindowsAccessible::accDoDefaultAction(VARIANT varID)
{
#ifdef DEBUG_SHOW_ATCLIENT_COMMANDS
showDebug(__FUNCTION__, accessible);
#endif //DEBUG_SHOW_ATCLIENT_COMMANDS
if (!accessible->isValid())
return E_FAIL;
return accessible->doAction(DefaultAction, varID.lVal, QVariantList()) ? S_OK : S_FALSE;
}
示例10: get_accState
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accState(VARIANT varID, VARIANT *pvarState)
{
showDebug(__FUNCTION__, accessible);
if (!accessible->isValid())
return E_FAIL;
(*pvarState).vt = VT_I4;
AccessibleElement elem(varID.lVal, accessible);
(*pvarState).lVal = elem.iface ? elem.iface->state(elem.entry) : State(Normal);
return S_OK;
}
示例11: get_accChildCount
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accChildCount(long* pcountChildren)
{
#ifdef DEBUG_SHOW_ATCLIENT_COMMANDS
showDebug(__FUNCTION__, accessible);
#endif //DEBUG_SHOW_ATCLIENT_COMMANDS
if (!accessible->isValid())
return E_FAIL;
*pcountChildren = accessible->childCount();
return S_OK;
}
示例12: get_accState
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accState(VARIANT varID, VARIANT *pvarState)
{
#ifdef DEBUG_SHOW_ATCLIENT_COMMANDS
showDebug(__FUNCTION__, accessible);
#endif //DEBUG_SHOW_ATCLIENT_COMMANDS
if (!accessible->isValid())
return E_FAIL;
(*pvarState).vt = VT_I4;
(*pvarState).lVal = accessible->state(varID.lVal);
return S_OK;
}
示例13: populateNode
static bool populateNode(JNIEnv *env, jobject /*thiz*/, jint objectId, jobject node)
{
QAccessibleInterface *iface = interfaceFromId(objectId);
if (!iface || !iface->isValid()) {
__android_log_print(ANDROID_LOG_WARN, m_qtTag, "Accessibility: populateNode for Invalid ID");
return false;
}
QAccessible::State state = iface->state();
const QStringList actions = QAccessibleBridgeUtils::effectiveActionNames(iface);
const bool hasClickableAction = actions.contains(QAccessibleActionInterface::pressAction())
|| actions.contains(QAccessibleActionInterface::toggleAction());
const bool hasIncreaseAction = actions.contains(QAccessibleActionInterface::increaseAction());
const bool hasDecreaseAction = actions.contains(QAccessibleActionInterface::decreaseAction());
// try to fill in the text property, this is what the screen reader reads
jstring jdesc = descriptionForAccessibleObject_helper(env, iface);
if (QAccessibleTextInterface *textIface = iface->textInterface()) {
if (m_setTextSelectionMethodID && textIface->selectionCount() > 0) {
int startSelection;
int endSelection;
textIface->selection(0, &startSelection, &endSelection);
env->CallVoidMethod(node, m_setTextSelectionMethodID, startSelection, endSelection);
}
}
env->CallVoidMethod(node, m_setEnabledMethodID, !state.disabled);
env->CallVoidMethod(node, m_setCheckableMethodID, (bool)state.checkable);
env->CallVoidMethod(node, m_setCheckedMethodID, (bool)state.checked);
env->CallVoidMethod(node, m_setFocusableMethodID, (bool)state.focusable);
env->CallVoidMethod(node, m_setFocusedMethodID, (bool)state.focused);
env->CallVoidMethod(node, m_setVisibleToUserMethodID, !state.invisible);
env->CallVoidMethod(node, m_setScrollableMethodID, hasIncreaseAction || hasDecreaseAction);
env->CallVoidMethod(node, m_setClickableMethodID, hasClickableAction);
// Add ACTION_CLICK
if (hasClickableAction)
env->CallVoidMethod(node, m_addActionMethodID, (int)16); // ACTION_CLICK defined in AccessibilityNodeInfo
// Add ACTION_SCROLL_FORWARD
if (hasIncreaseAction)
env->CallVoidMethod(node, m_addActionMethodID, (int)4096); // ACTION_SCROLL_FORWARD defined in AccessibilityNodeInfo
// Add ACTION_SCROLL_BACKWARD
if (hasDecreaseAction)
env->CallVoidMethod(node, m_addActionMethodID, (int)8192); // ACTION_SCROLL_BACKWARD defined in AccessibilityNodeInfo
//CALL_METHOD(node, "setText", "(Ljava/lang/CharSequence;)V", jdesc)
env->CallVoidMethod(node, m_setContentDescriptionMethodID, jdesc);
return true;
}
示例14: GetWindow
HRESULT STDMETHODCALLTYPE QWindowsAccessible::GetWindow(HWND *phwnd)
{
*phwnd = 0;
if (!accessible->isValid())
return E_UNEXPECTED;
QObject *o = accessible->object();
if (!o || !o->isWidgetType())
return E_FAIL;
*phwnd = static_cast<QWidget*>(o)->winId();
return S_OK;
}
示例15: while
QWindow *QWindowsAccessibility::windowHelper(const QAccessibleInterface *iface)
{
QWindow *window = iface->window();
if (!window) {
QAccessibleInterface *acc = iface->parent();
while (acc && acc->isValid() && !window) {
window = acc->window();
QAccessibleInterface *par = acc->parent();
acc = par;
}
}
return window;
}