Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwindowsuiawindowprovider.cpp
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <QtGui/qtguiglobal.h>
5#if QT_CONFIG(accessibility)
6
8#include "qwindowsuiautils.h"
9#include "qwindowscontext.h"
10
11#include <QtGui/qaccessible.h>
12#include <QtGui/private/qwindow_p.h>
13#include <QtCore/qloggingcategory.h>
14#include <QtCore/qstring.h>
15
17
18using namespace QWindowsUiAutomation;
19
20
21QWindowsUiaWindowProvider::QWindowsUiaWindowProvider(QAccessible::Id id) :
22 QWindowsUiaBaseProvider(id)
23{
24}
25
26QWindowsUiaWindowProvider::~QWindowsUiaWindowProvider()
27{
28}
29
30HRESULT STDMETHODCALLTYPE QWindowsUiaWindowProvider::SetVisualState(WindowVisualState state) {
31 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
32 QAccessibleInterface *accessible = accessibleInterface();
33 if (!accessible || !accessible->window())
34 return UIA_E_ELEMENTNOTAVAILABLE;
35 auto window = accessible->window();
36 switch (state) {
37 case WindowVisualState_Normal:
38 window->showNormal();
39 break;
40 case WindowVisualState_Maximized:
41 window->showMaximized();
42 break;
43 case WindowVisualState_Minimized:
44 window->showMinimized();
45 break;
46 }
47 return S_OK;
48}
49
50HRESULT STDMETHODCALLTYPE QWindowsUiaWindowProvider::Close() {
51 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
52 QAccessibleInterface *accessible = accessibleInterface();
53 if (!accessible || !accessible->window())
54 return UIA_E_ELEMENTNOTAVAILABLE;
55 accessible->window()->close();
56 return S_OK;
57}
58
59HRESULT STDMETHODCALLTYPE QWindowsUiaWindowProvider::WaitForInputIdle(int milliseconds, __RPC__out BOOL *pRetVal) {
60 Q_UNUSED(milliseconds);
61 Q_UNUSED(pRetVal);
62 return UIA_E_NOTSUPPORTED;
63}
64
65HRESULT STDMETHODCALLTYPE QWindowsUiaWindowProvider::get_CanMaximize(__RPC__out BOOL *pRetVal) {
66 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
67 QAccessibleInterface *accessible = accessibleInterface();
68 if (!accessible || !accessible->window())
69 return UIA_E_ELEMENTNOTAVAILABLE;
70
71 auto window = accessible->window();
72 auto flags = window->flags();
73
77 || window->maximumSize() == QSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX)));
78 return S_OK;
79}
80
81HRESULT STDMETHODCALLTYPE QWindowsUiaWindowProvider::get_CanMinimize(__RPC__out BOOL *pRetVal) {
82 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
83 QAccessibleInterface *accessible = accessibleInterface();
84 if (!accessible || !accessible->window())
85 return UIA_E_ELEMENTNOTAVAILABLE;
86 *pRetVal = accessible->window()->flags() & Qt::WindowMinimizeButtonHint;
87 return S_OK;
88}
89
90HRESULT STDMETHODCALLTYPE QWindowsUiaWindowProvider::get_IsModal(__RPC__out BOOL *pRetVal) {
91 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
92 QAccessibleInterface *accessible = accessibleInterface();
93 if (!accessible || !accessible->window())
94 return UIA_E_ELEMENTNOTAVAILABLE;
95 *pRetVal = accessible->window()->isModal();
96 return S_OK;
97}
98
99HRESULT STDMETHODCALLTYPE QWindowsUiaWindowProvider::get_WindowVisualState(__RPC__out enum WindowVisualState *pRetVal) {
100 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
101 QAccessibleInterface *accessible = accessibleInterface();
102 if (!accessible || !accessible->window())
103 return UIA_E_ELEMENTNOTAVAILABLE;
104 auto visibility = accessible->window()->visibility();
105 switch (visibility) {
106 case QWindow::FullScreen:
107 case QWindow::Maximized:
108 *pRetVal = WindowVisualState_Maximized;
109 break;
110 case QWindow::Minimized:
111 *pRetVal = WindowVisualState_Minimized;
112 break;
113 default:
114 *pRetVal = WindowVisualState_Normal;
115 break;
116 }
117 return S_OK;
118}
119
120HRESULT STDMETHODCALLTYPE QWindowsUiaWindowProvider::get_WindowInteractionState(__RPC__out enum WindowInteractionState *pRetVal) {
121 Q_UNUSED(pRetVal);
122 return UIA_E_NOTSUPPORTED;
123}
124
125HRESULT STDMETHODCALLTYPE QWindowsUiaWindowProvider::get_IsTopmost(__RPC__out BOOL *pRetVal) {
126 Q_UNUSED(pRetVal);
127 return UIA_E_NOTSUPPORTED;
128}
129
131
132#endif // QT_CONFIG(accessibility)
\inmodule QtCore
Definition qsize.h:25
else opt state
[0]
Combined button and popup list for selecting options.
@ CustomizeWindowHint
Definition qnamespace.h:239
@ MSWindowsFixedSizeDialogHint
Definition qnamespace.h:221
@ WindowMaximizeButtonHint
Definition qnamespace.h:229
@ WindowMinimizeButtonHint
Definition qnamespace.h:228
#define qCDebug(category,...)
GLenum GLuint id
[7]
GLbitfield flags
#define QWINDOWSIZE_MAX
#define Q_UNUSED(x)
long HRESULT
aWidget window() -> setWindowTitle("New Window Title")
[2]