本文整理汇总了C++中QWindow::accessibleRoot方法的典型用法代码示例。如果您正苦于以下问题:C++ QWindow::accessibleRoot方法的具体用法?C++ QWindow::accessibleRoot怎么用?C++ QWindow::accessibleRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWindow
的用法示例。
在下文中一共展示了QWindow::accessibleRoot方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
QAccessibleInterface *interfaceFromId(jint objectId)
{
QAccessibleInterface *iface = 0;
if (objectId == -1) {
QWindow *win = qApp->focusWindow();
if (win)
iface = win->accessibleRoot();
} else {
iface = QAccessible::accessibleInterface(objectId);
}
return iface;
}
示例2: topLevelObjects
// all toplevel windows except popups and the desktop
static QObjectList topLevelObjects()
{
QObjectList list;
const QWindowList tlw(QGuiApplication::topLevelWindows());
for (int i = 0; i < tlw.count(); ++i) {
QWindow *w = tlw.at(i);
if (w->type() != Qt::Popup && w->type() != Qt::Desktop) {
if (QAccessibleInterface *root = w->accessibleRoot()) {
if (root->object())
list.append(root->object());
}
}
}
return list;
}
示例3: handleAccessibleObjectFromWindowRequest
bool QWindowsAccessibility::handleAccessibleObjectFromWindowRequest(HWND hwnd, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
{
#if !defined(Q_OS_WINCE)
if (static_cast<long>(lParam) == static_cast<long>(UiaRootObjectId)) {
/* For UI Automation */
} else if ((DWORD)lParam == DWORD(OBJID_CLIENT)) {
// Start handling accessibility internally
QGuiApplicationPrivate::platformIntegration()->accessibility()->setActive(true);
// Ignoring all requests while starting up
// ### Maybe QPA takes care of this???
if (QCoreApplication::startingUp() || QCoreApplication::closingDown())
return false;
typedef LRESULT (WINAPI *PtrLresultFromObject)(REFIID, WPARAM, LPUNKNOWN);
static PtrLresultFromObject ptrLresultFromObject = 0;
static bool oleaccChecked = false;
if (!oleaccChecked) {
oleaccChecked = true;
ptrLresultFromObject = (PtrLresultFromObject)QSystemLibrary::resolve(QLatin1String("oleacc"), "LresultFromObject");
}
if (ptrLresultFromObject) {
QWindow *window = QWindowsContext::instance()->findWindow(hwnd);
if (window) {
QAccessibleInterface *acc = window->accessibleRoot();
if (acc) {
if (IAccessible *iface = wrap(acc)) {
*lResult = ptrLresultFromObject(IID_IAccessible, wParam, iface); // ref == 2
if (*lResult) {
iface->Release(); // the client will release the object again, and then it will destroy itself
}
return true;
}
}
}
}
}
#else
Q_UNUSED(hwnd);
Q_UNUSED(wParam);
Q_UNUSED(lParam);
Q_UNUSED(lResult);
#endif // !defined(Q_OS_WINCE)
return false;
}
示例4: handleAccessibleObjectFromWindowRequest
bool QWindowsAccessibility::handleAccessibleObjectFromWindowRequest(HWND hwnd, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
{
if (static_cast<long>(lParam) == static_cast<long>(UiaRootObjectId)) {
/* For UI Automation
*/
} else if ((DWORD)lParam == OBJID_CLIENT) {
#if 1
// Ignoring all requests while starting up
// ### Maybe QPA takes care of this???
if (QApplication::startingUp() || QApplication::closingDown())
return false;
#endif
typedef LRESULT (WINAPI *PtrLresultFromObject)(REFIID, WPARAM, LPUNKNOWN);
static PtrLresultFromObject ptrLresultFromObject = 0;
static bool oleaccChecked = false;
if (!oleaccChecked) {
oleaccChecked = true;
#if !defined(Q_OS_WINCE)
ptrLresultFromObject = (PtrLresultFromObject)QSystemLibrary::resolve(QLatin1String("oleacc"), "LresultFromObject");
#endif
}
if (ptrLresultFromObject) {
QWindow *window = QWindowsContext::instance()->findWindow(hwnd);
if (window) {
QAccessibleInterface *acc = window->accessibleRoot();
if (acc) {
QWindowsAccessible *winacc = new QWindowsAccessible(acc);
IAccessible *iface;
HRESULT hr = winacc->QueryInterface(IID_IAccessible, (void**)&iface);
if (SUCCEEDED(hr)) {
*lResult = ptrLresultFromObject(IID_IAccessible, wParam, iface); // ref == 2
if (*lResult) {
iface->Release(); // the client will release the object again, and then it will destroy itself
}
return true;
}
}
}
}
}
return false;
}