Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qguiapplication.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||
8 | - | |||||||||||||||||||||||||
9 | - | |||||||||||||||||||||||||
10 | - | |||||||||||||||||||||||||
11 | - | |||||||||||||||||||||||||
12 | - | |||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||
14 | - | |||||||||||||||||||||||||
15 | - | |||||||||||||||||||||||||
16 | - | |||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||
18 | __attribute__((visibility("default"))) bool qt_is_gui_used = true; | - | ||||||||||||||||||||||||
19 | - | |||||||||||||||||||||||||
20 | Qt::MouseButtons QGuiApplicationPrivate::mouse_buttons = Qt::NoButton; | - | ||||||||||||||||||||||||
21 | Qt::KeyboardModifiers QGuiApplicationPrivate::modifier_buttons = Qt::NoModifier; | - | ||||||||||||||||||||||||
22 | - | |||||||||||||||||||||||||
23 | QPointF QGuiApplicationPrivate::lastCursorPosition(qInf(), qInf()); | - | ||||||||||||||||||||||||
24 | - | |||||||||||||||||||||||||
Qt::MouseButtons QGuiApplicationPrivate::tabletState = Qt::NoButton; | ||||||||||||||||||||||||||
QWindow *QGuiApplicationPrivate::tabletPressTarget = 0;QWindow *QGuiApplicationPrivate::currentMouseWindow = 0; | ||||||||||||||||||||||||||
26 | - | |||||||||||||||||||||||||
27 | QString QGuiApplicationPrivate::styleOverride; | - | ||||||||||||||||||||||||
28 | - | |||||||||||||||||||||||||
29 | Qt::ApplicationState QGuiApplicationPrivate::applicationState = Qt::ApplicationInactive; | - | ||||||||||||||||||||||||
30 | - | |||||||||||||||||||||||||
31 | bool QGuiApplicationPrivate::highDpiScalingUpdated = false; | - | ||||||||||||||||||||||||
32 | - | |||||||||||||||||||||||||
33 | QVector<QGuiApplicationPrivate::TabletPointData> QGuiApplicationPrivate::tabletDevicePoints; | - | ||||||||||||||||||||||||
34 | - | |||||||||||||||||||||||||
35 | QPlatformIntegration *QGuiApplicationPrivate::platform_integration = 0; | - | ||||||||||||||||||||||||
36 | QPlatformTheme *QGuiApplicationPrivate::platform_theme = 0; | - | ||||||||||||||||||||||||
37 | - | |||||||||||||||||||||||||
38 | QList<QObject *> QGuiApplicationPrivate::generic_plugin_list; | - | ||||||||||||||||||||||||
39 | - | |||||||||||||||||||||||||
40 | - | |||||||||||||||||||||||||
41 | bool QGuiApplicationPrivate::is_fallback_session_management_enabled = true; | - | ||||||||||||||||||||||||
42 | - | |||||||||||||||||||||||||
43 | - | |||||||||||||||||||||||||
44 | enum ApplicationResourceFlags | - | ||||||||||||||||||||||||
45 | { | - | ||||||||||||||||||||||||
46 | ApplicationPaletteExplicitlySet = 0x1, | - | ||||||||||||||||||||||||
47 | ApplicationFontExplicitlySet = 0x2 | - | ||||||||||||||||||||||||
48 | }; | - | ||||||||||||||||||||||||
49 | - | |||||||||||||||||||||||||
50 | static unsigned applicationResourceFlags = 0; | - | ||||||||||||||||||||||||
51 | - | |||||||||||||||||||||||||
52 | QIcon *QGuiApplicationPrivate::app_icon = 0; | - | ||||||||||||||||||||||||
53 | - | |||||||||||||||||||||||||
54 | QString *QGuiApplicationPrivate::platform_name = 0; | - | ||||||||||||||||||||||||
55 | QString *QGuiApplicationPrivate::displayName = 0; | - | ||||||||||||||||||||||||
56 | QString *QGuiApplicationPrivate::desktopFileName = 0; | - | ||||||||||||||||||||||||
57 | - | |||||||||||||||||||||||||
58 | QPalette *QGuiApplicationPrivate::app_pal = 0; | - | ||||||||||||||||||||||||
59 | - | |||||||||||||||||||||||||
60 | Qt::MouseButtons QGuiApplicationPrivate::buttons = Qt::NoButton; | - | ||||||||||||||||||||||||
61 | - | |||||||||||||||||||||||||
62 | ulong QGuiApplicationPrivate::mousePressTime = 0; | - | ||||||||||||||||||||||||
63 | Qt::MouseButton QGuiApplicationPrivate::mousePressButton = Qt::NoButton; | - | ||||||||||||||||||||||||
64 | int QGuiApplicationPrivate::mousePressX = 0; | - | ||||||||||||||||||||||||
65 | int QGuiApplicationPrivate::mousePressY = 0; | - | ||||||||||||||||||||||||
66 | int QGuiApplicationPrivate::mouse_double_click_distance = -1; | - | ||||||||||||||||||||||||
67 | - | |||||||||||||||||||||||||
68 | QWindow *QGuiApplicationPrivate::currentMousePressWindow = 0; | - | ||||||||||||||||||||||||
69 | - | |||||||||||||||||||||||||
70 | static Qt::LayoutDirection layout_direction = Qt::LayoutDirectionAuto; | - | ||||||||||||||||||||||||
71 | static bool force_reverse = false; | - | ||||||||||||||||||||||||
72 | - | |||||||||||||||||||||||||
73 | QGuiApplicationPrivate *QGuiApplicationPrivate::self = 0; | - | ||||||||||||||||||||||||
74 | QTouchDevice *QGuiApplicationPrivate::m_fakeTouchDevice = 0; | - | ||||||||||||||||||||||||
75 | int QGuiApplicationPrivate::m_fakeMouseSourcePointId = 0; | - | ||||||||||||||||||||||||
76 | - | |||||||||||||||||||||||||
77 | - | |||||||||||||||||||||||||
78 | QClipboard *QGuiApplicationPrivate::qt_clipboard = 0; | - | ||||||||||||||||||||||||
79 | - | |||||||||||||||||||||||||
80 | - | |||||||||||||||||||||||||
81 | QList<QScreen *> QGuiApplicationPrivate::screen_list; | - | ||||||||||||||||||||||||
82 | - | |||||||||||||||||||||||||
83 | QWindowList QGuiApplicationPrivate::window_list; | - | ||||||||||||||||||||||||
84 | QWindow *QGuiApplicationPrivate::focus_window = 0; | - | ||||||||||||||||||||||||
85 | - | |||||||||||||||||||||||||
86 | static QBasicMutex applicationFontMutex; | - | ||||||||||||||||||||||||
87 | QFont *QGuiApplicationPrivate::app_font = 0; | - | ||||||||||||||||||||||||
88 | QStyleHints *QGuiApplicationPrivate::styleHints = nullptr; | - | ||||||||||||||||||||||||
89 | bool QGuiApplicationPrivate::obey_desktop_settings = true; | - | ||||||||||||||||||||||||
90 | - | |||||||||||||||||||||||||
91 | QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = 0; | - | ||||||||||||||||||||||||
bool QGuiApplicationPrivate::scrollNoPhaseAllowed = false; | ||||||||||||||||||||||||||
92 | - | |||||||||||||||||||||||||
93 | static qreal fontSmoothingGamma = 1.7; | - | ||||||||||||||||||||||||
94 | - | |||||||||||||||||||||||||
95 | extern void qRegisterGuiVariant(); | - | ||||||||||||||||||||||||
96 | - | |||||||||||||||||||||||||
97 | extern void qRegisterGuiGetInterpolator(); | - | ||||||||||||||||||||||||
98 | - | |||||||||||||||||||||||||
99 | - | |||||||||||||||||||||||||
100 | static bool qt_detectRTLLanguage() | - | ||||||||||||||||||||||||
101 | { | - | ||||||||||||||||||||||||
102 | return force_reverse ^ | - | ||||||||||||||||||||||||
103 | (QGuiApplication::tr("QT_LAYOUT_DIRECTION", | - | ||||||||||||||||||||||||
104 | "Translate this string to the string 'LTR' in left-to-right" | - | ||||||||||||||||||||||||
105 | " languages or to 'RTL' in right-to-left languages (such as Hebrew" | - | ||||||||||||||||||||||||
106 | " and Arabic) to get proper widget layout.") == QLatin1String("RTL")); | - | ||||||||||||||||||||||||
107 | } | - | ||||||||||||||||||||||||
108 | - | |||||||||||||||||||||||||
109 | static void initPalette() | - | ||||||||||||||||||||||||
110 | { | - | ||||||||||||||||||||||||
111 | if (!QGuiApplicationPrivate::app_pal) | - | ||||||||||||||||||||||||
112 | if (const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette()) | - | ||||||||||||||||||||||||
113 | QGuiApplicationPrivate::app_pal = new QPalette(*themePalette); | - | ||||||||||||||||||||||||
114 | if (!QGuiApplicationPrivate::app_pal) | - | ||||||||||||||||||||||||
115 | QGuiApplicationPrivate::app_pal = new QPalette(Qt::gray); | - | ||||||||||||||||||||||||
116 | } | - | ||||||||||||||||||||||||
117 | - | |||||||||||||||||||||||||
118 | static inline void clearPalette() | - | ||||||||||||||||||||||||
119 | { | - | ||||||||||||||||||||||||
120 | delete QGuiApplicationPrivate::app_pal; | - | ||||||||||||||||||||||||
121 | QGuiApplicationPrivate::app_pal = 0; | - | ||||||||||||||||||||||||
122 | } | - | ||||||||||||||||||||||||
123 | - | |||||||||||||||||||||||||
124 | static void initFontUnlocked() | - | ||||||||||||||||||||||||
125 | { | - | ||||||||||||||||||||||||
126 | if (!QGuiApplicationPrivate::app_font) { | - | ||||||||||||||||||||||||
127 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) | - | ||||||||||||||||||||||||
128 | if (const QFont *font = theme->font(QPlatformTheme::SystemFont)) | - | ||||||||||||||||||||||||
129 | QGuiApplicationPrivate::app_font = new QFont(*font); | - | ||||||||||||||||||||||||
130 | } | - | ||||||||||||||||||||||||
131 | if (!QGuiApplicationPrivate::app_font) | - | ||||||||||||||||||||||||
132 | QGuiApplicationPrivate::app_font = | - | ||||||||||||||||||||||||
133 | new QFont(QGuiApplicationPrivate::platformIntegration()->fontDatabase()->defaultFont()); | - | ||||||||||||||||||||||||
134 | } | - | ||||||||||||||||||||||||
135 | - | |||||||||||||||||||||||||
136 | static inline void clearFontUnlocked() | - | ||||||||||||||||||||||||
137 | { | - | ||||||||||||||||||||||||
138 | delete QGuiApplicationPrivate::app_font; | - | ||||||||||||||||||||||||
139 | QGuiApplicationPrivate::app_font = 0; | - | ||||||||||||||||||||||||
140 | } | - | ||||||||||||||||||||||||
141 | - | |||||||||||||||||||||||||
142 | - | |||||||||||||||||||||||||
143 | - | |||||||||||||||||||||||||
144 | - | |||||||||||||||||||||||||
145 | - | |||||||||||||||||||||||||
146 | - | |||||||||||||||||||||||||
147 | struct QWindowGeometrySpecification | - | ||||||||||||||||||||||||
148 | { | - | ||||||||||||||||||||||||
149 | static QWindowGeometrySpecification fromArgument(const QByteArray &a); | - | ||||||||||||||||||||||||
150 | void applyTo(QWindow *window) const; | - | ||||||||||||||||||||||||
151 | - | |||||||||||||||||||||||||
152 | Qt::Corner corner; | - | ||||||||||||||||||||||||
153 | int xOffset; | - | ||||||||||||||||||||||||
154 | int yOffset; | - | ||||||||||||||||||||||||
155 | int width; | - | ||||||||||||||||||||||||
156 | int height; | - | ||||||||||||||||||||||||
157 | }; | - | ||||||||||||||||||||||||
158 | - | |||||||||||||||||||||||||
159 | - | |||||||||||||||||||||||||
160 | static inline int nextGeometryToken(const QByteArray &a, int &pos, char *op) | - | ||||||||||||||||||||||||
161 | { | - | ||||||||||||||||||||||||
162 | *op = 0; | - | ||||||||||||||||||||||||
163 | const int size = a.size(); | - | ||||||||||||||||||||||||
164 | if (pos >= size) | - | ||||||||||||||||||||||||
165 | return -1; | - | ||||||||||||||||||||||||
166 | - | |||||||||||||||||||||||||
167 | *op = a.at(pos); | - | ||||||||||||||||||||||||
168 | if (*op == '+' || *op == '-' || *op == 'x') | - | ||||||||||||||||||||||||
169 | pos++; | - | ||||||||||||||||||||||||
170 | else if (isdigit(*op)) | - | ||||||||||||||||||||||||
171 | *op = 'x'; | - | ||||||||||||||||||||||||
172 | else | - | ||||||||||||||||||||||||
173 | return -1; | - | ||||||||||||||||||||||||
174 | - | |||||||||||||||||||||||||
175 | const int numberPos = pos; | - | ||||||||||||||||||||||||
176 | for ( ; pos < size && isdigit(a.at(pos)); ++pos) ; | - | ||||||||||||||||||||||||
177 | - | |||||||||||||||||||||||||
178 | bool ok; | - | ||||||||||||||||||||||||
179 | const int result = a.mid(numberPos, pos - numberPos).toInt(&ok); | - | ||||||||||||||||||||||||
180 | return ok ? result : -1; | - | ||||||||||||||||||||||||
181 | } | - | ||||||||||||||||||||||||
182 | - | |||||||||||||||||||||||||
183 | QWindowGeometrySpecification QWindowGeometrySpecification::fromArgument(const QByteArray &a) | - | ||||||||||||||||||||||||
184 | { | - | ||||||||||||||||||||||||
185 | QWindowGeometrySpecification result = { Qt::TopLeftCorner, -1, -1, -1, -1 }; | - | ||||||||||||||||||||||||
186 | int pos = 0; | - | ||||||||||||||||||||||||
187 | for (int i = 0; i < 4; ++i) { | - | ||||||||||||||||||||||||
188 | char op; | - | ||||||||||||||||||||||||
189 | const int value = nextGeometryToken(a, pos, &op); | - | ||||||||||||||||||||||||
190 | if (value < 0) | - | ||||||||||||||||||||||||
191 | break; | - | ||||||||||||||||||||||||
192 | switch (op) { | - | ||||||||||||||||||||||||
193 | case 'x': | - | ||||||||||||||||||||||||
194 | (result.width >= 0 ? result.height : result.width) = value; | - | ||||||||||||||||||||||||
195 | break; | - | ||||||||||||||||||||||||
196 | case '+': | - | ||||||||||||||||||||||||
197 | case '-': | - | ||||||||||||||||||||||||
198 | if (result.xOffset >= 0) { | - | ||||||||||||||||||||||||
199 | result.yOffset = value; | - | ||||||||||||||||||||||||
200 | if (op == '-') | - | ||||||||||||||||||||||||
201 | result.corner = result.corner == Qt::TopRightCorner ? Qt::BottomRightCorner : Qt::BottomLeftCorner; | - | ||||||||||||||||||||||||
202 | } else { | - | ||||||||||||||||||||||||
203 | result.xOffset = value; | - | ||||||||||||||||||||||||
204 | if (op == '-') | - | ||||||||||||||||||||||||
205 | result.corner = Qt::TopRightCorner; | - | ||||||||||||||||||||||||
206 | } | - | ||||||||||||||||||||||||
207 | } | - | ||||||||||||||||||||||||
208 | } | - | ||||||||||||||||||||||||
209 | return result; | - | ||||||||||||||||||||||||
210 | } | - | ||||||||||||||||||||||||
211 | - | |||||||||||||||||||||||||
212 | void QWindowGeometrySpecification::applyTo(QWindow *window) const | - | ||||||||||||||||||||||||
213 | { | - | ||||||||||||||||||||||||
214 | QRect windowGeometry = window->frameGeometry(); | - | ||||||||||||||||||||||||
215 | QSize size = windowGeometry.size(); | - | ||||||||||||||||||||||||
216 | if (width >= 0 || height >= 0) { | - | ||||||||||||||||||||||||
217 | const QSize windowMinimumSize = window->minimumSize(); | - | ||||||||||||||||||||||||
218 | const QSize windowMaximumSize = window->maximumSize(); | - | ||||||||||||||||||||||||
219 | if (width >= 0) | - | ||||||||||||||||||||||||
220 | size.setWidth(qBound(windowMinimumSize.width(), width, windowMaximumSize.width())); | - | ||||||||||||||||||||||||
221 | if (height >= 0) | - | ||||||||||||||||||||||||
222 | size.setHeight(qBound(windowMinimumSize.height(), height, windowMaximumSize.height())); | - | ||||||||||||||||||||||||
223 | window->resize(size); | - | ||||||||||||||||||||||||
224 | } | - | ||||||||||||||||||||||||
225 | if (xOffset >= 0 || yOffset >= 0) { | - | ||||||||||||||||||||||||
226 | const QRect availableGeometry = window->screen()->virtualGeometry(); | - | ||||||||||||||||||||||||
227 | QPoint topLeft = windowGeometry.topLeft(); | - | ||||||||||||||||||||||||
228 | if (xOffset >= 0) { | - | ||||||||||||||||||||||||
229 | topLeft.setX(corner == Qt::TopLeftCorner || corner == Qt::BottomLeftCorner ? | - | ||||||||||||||||||||||||
230 | xOffset : | - | ||||||||||||||||||||||||
231 | qMax(availableGeometry.right() - size.width() - xOffset, availableGeometry.left())); | - | ||||||||||||||||||||||||
232 | } | - | ||||||||||||||||||||||||
233 | if (yOffset >= 0) { | - | ||||||||||||||||||||||||
234 | topLeft.setY(corner == Qt::TopLeftCorner || corner == Qt::TopRightCorner ? | - | ||||||||||||||||||||||||
235 | yOffset : | - | ||||||||||||||||||||||||
236 | qMax(availableGeometry.bottom() - size.height() - yOffset, availableGeometry.top())); | - | ||||||||||||||||||||||||
237 | } | - | ||||||||||||||||||||||||
238 | window->setFramePosition(topLeft); | - | ||||||||||||||||||||||||
239 | } | - | ||||||||||||||||||||||||
240 | } | - | ||||||||||||||||||||||||
241 | - | |||||||||||||||||||||||||
242 | static QWindowGeometrySpecification windowGeometrySpecification = { Qt::TopLeftCorner, -1, -1, -1, -1 }; | - | ||||||||||||||||||||||||
243 | QGuiApplication::QGuiApplication(int &argc, char **argv, int flags) | - | ||||||||||||||||||||||||
244 | - | |||||||||||||||||||||||||
245 | : QCoreApplication(*new QGuiApplicationPrivate(argc, argv, flags)) | - | ||||||||||||||||||||||||
246 | { | - | ||||||||||||||||||||||||
247 | d_func()->init(); | - | ||||||||||||||||||||||||
248 | - | |||||||||||||||||||||||||
249 | QCoreApplicationPrivate::eventDispatcher->startingUp(); | - | ||||||||||||||||||||||||
250 | } | - | ||||||||||||||||||||||||
251 | - | |||||||||||||||||||||||||
252 | - | |||||||||||||||||||||||||
253 | - | |||||||||||||||||||||||||
254 | - | |||||||||||||||||||||||||
255 | QGuiApplication::QGuiApplication(QGuiApplicationPrivate &p) | - | ||||||||||||||||||||||||
256 | : QCoreApplication(p) | - | ||||||||||||||||||||||||
257 | { | - | ||||||||||||||||||||||||
258 | } | - | ||||||||||||||||||||||||
259 | - | |||||||||||||||||||||||||
260 | - | |||||||||||||||||||||||||
261 | - | |||||||||||||||||||||||||
262 | - | |||||||||||||||||||||||||
263 | QGuiApplication::~QGuiApplication() | - | ||||||||||||||||||||||||
264 | { | - | ||||||||||||||||||||||||
265 | QGuiApplicationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
266 | - | |||||||||||||||||||||||||
267 | d->eventDispatcher->closingDown(); | - | ||||||||||||||||||||||||
268 | d->eventDispatcher = 0; | - | ||||||||||||||||||||||||
269 | - | |||||||||||||||||||||||||
270 | - | |||||||||||||||||||||||||
271 | delete QGuiApplicationPrivate::qt_clipboard; | - | ||||||||||||||||||||||||
272 | QGuiApplicationPrivate::qt_clipboard = 0; | - | ||||||||||||||||||||||||
273 | - | |||||||||||||||||||||||||
274 | - | |||||||||||||||||||||||||
275 | - | |||||||||||||||||||||||||
276 | delete d->session_manager; | - | ||||||||||||||||||||||||
277 | d->session_manager = 0; | - | ||||||||||||||||||||||||
278 | - | |||||||||||||||||||||||||
279 | - | |||||||||||||||||||||||||
280 | clearPalette(); | - | ||||||||||||||||||||||||
281 | QFontDatabase::removeAllApplicationFonts(); | - | ||||||||||||||||||||||||
282 | - | |||||||||||||||||||||||||
283 | - | |||||||||||||||||||||||||
284 | d->cursor_list.clear(); | - | ||||||||||||||||||||||||
285 | - | |||||||||||||||||||||||||
286 | - | |||||||||||||||||||||||||
287 | delete QGuiApplicationPrivate::app_icon; | - | ||||||||||||||||||||||||
288 | QGuiApplicationPrivate::app_icon = 0; | - | ||||||||||||||||||||||||
289 | delete QGuiApplicationPrivate::platform_name; | - | ||||||||||||||||||||||||
290 | QGuiApplicationPrivate::platform_name = 0; | - | ||||||||||||||||||||||||
291 | delete QGuiApplicationPrivate::displayName; | - | ||||||||||||||||||||||||
292 | QGuiApplicationPrivate::displayName = 0; | - | ||||||||||||||||||||||||
293 | delete QGuiApplicationPrivate::m_inputDeviceManager; | - | ||||||||||||||||||||||||
294 | QGuiApplicationPrivate::m_inputDeviceManager = 0; | - | ||||||||||||||||||||||||
295 | delete QGuiApplicationPrivate::desktopFileName; | - | ||||||||||||||||||||||||
296 | QGuiApplicationPrivate::desktopFileName = 0; | - | ||||||||||||||||||||||||
297 | } never executed: end of block | 0 | ||||||||||||||||||||||||
298 | - | |||||||||||||||||||||||||
299 | QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags) | - | ||||||||||||||||||||||||
300 | : QCoreApplicationPrivate(argc, argv, flags), | - | ||||||||||||||||||||||||
301 | inputMethod(0), | - | ||||||||||||||||||||||||
302 | lastTouchType(QEvent::TouchEnd), | - | ||||||||||||||||||||||||
303 | ownGlobalShareContext(false) | - | ||||||||||||||||||||||||
304 | { | - | ||||||||||||||||||||||||
305 | self = this; | - | ||||||||||||||||||||||||
306 | application_type = QCoreApplicationPrivate::Gui; | - | ||||||||||||||||||||||||
307 | - | |||||||||||||||||||||||||
308 | is_session_restored = false; | - | ||||||||||||||||||||||||
309 | is_saving_session = false; | - | ||||||||||||||||||||||||
310 | - | |||||||||||||||||||||||||
311 | } | - | ||||||||||||||||||||||||
312 | void QGuiApplication::setApplicationDisplayName(const QString &name) | - | ||||||||||||||||||||||||
313 | { | - | ||||||||||||||||||||||||
314 | if (!QGuiApplicationPrivate::displayName) | - | ||||||||||||||||||||||||
315 | QGuiApplicationPrivate::displayName = new QString; | - | ||||||||||||||||||||||||
316 | *QGuiApplicationPrivate::displayName = name; | - | ||||||||||||||||||||||||
317 | } | - | ||||||||||||||||||||||||
318 | - | |||||||||||||||||||||||||
319 | QString QGuiApplication::applicationDisplayName() | - | ||||||||||||||||||||||||
320 | { | - | ||||||||||||||||||||||||
321 | return QGuiApplicationPrivate::displayName ? *QGuiApplicationPrivate::displayName : applicationName(); | - | ||||||||||||||||||||||||
322 | } | - | ||||||||||||||||||||||||
323 | void QGuiApplication::setDesktopFileName(const QString &name) | - | ||||||||||||||||||||||||
324 | { | - | ||||||||||||||||||||||||
325 | if (!QGuiApplicationPrivate::desktopFileName
| 0 | ||||||||||||||||||||||||
326 | QGuiApplicationPrivate::desktopFileName = new QString; never executed: QGuiApplicationPrivate::desktopFileName = new QString; | 0 | ||||||||||||||||||||||||
327 | *QGuiApplicationPrivate::desktopFileName = name; | - | ||||||||||||||||||||||||
328 | } never executed: end of block | 0 | ||||||||||||||||||||||||
329 | - | |||||||||||||||||||||||||
330 | QString QGuiApplication::desktopFileName() | - | ||||||||||||||||||||||||
331 | { | - | ||||||||||||||||||||||||
332 | return never executed: QGuiApplicationPrivate::desktopFileName ? *QGuiApplicationPrivate::desktopFileName : QStringreturn QGuiApplicationPrivate::desktopFileName ? *QGuiApplicationPrivate::desktopFileName : QString(); never executed: return QGuiApplicationPrivate::desktopFileName ? *QGuiApplicationPrivate::desktopFileName : QString(); never executed: ();return QGuiApplicationPrivate::desktopFileName ? *QGuiApplicationPrivate::desktopFileName : QString(); never executed: return QGuiApplicationPrivate::desktopFileName ? *QGuiApplicationPrivate::desktopFileName : QString(); | 0 | ||||||||||||||||||||||||
333 | } | - | ||||||||||||||||||||||||
334 | QWindow *QGuiApplication::modalWindow() | - | ||||||||||||||||||||||||
335 | { | - | ||||||||||||||||||||||||
336 | if (__builtin_expect(!!(QCoreApplication::instance()), true)) { } else { QMessageLogger(__FILE__, 687723, __PRETTY_FUNCTION__).warning("Must construct a QGuiApplication first."); return nullptr; } | - | ||||||||||||||||||||||||
337 | if (QGuiApplicationPrivate::self->modalWindowList.isEmpty()) | - | ||||||||||||||||||||||||
338 | return 0; | - | ||||||||||||||||||||||||
339 | return QGuiApplicationPrivate::self->modalWindowList.first(); | - | ||||||||||||||||||||||||
340 | } | - | ||||||||||||||||||||||||
341 | - | |||||||||||||||||||||||||
342 | static void updateBlockedStatusRecursion(QWindow *window, bool shouldBeBlocked) | - | ||||||||||||||||||||||||
343 | { | - | ||||||||||||||||||||||||
344 | QWindowPrivate *p = qt_window_private(window); | - | ||||||||||||||||||||||||
345 | if (p->blockedByModalWindow != shouldBeBlocked
| 0 | ||||||||||||||||||||||||
346 | p->blockedByModalWindow = shouldBeBlocked; | - | ||||||||||||||||||||||||
347 | QEvent e(shouldBeBlocked ? QEvent::WindowBlocked : QEvent::WindowUnblocked); | - | ||||||||||||||||||||||||
348 | QGuiApplication::sendEvent(window, &e); | - | ||||||||||||||||||||||||
349 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(window->children())>::type> _container_((window->children())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (QObject *c = *_container_.i; _container_.control; _container_.control = 0): window->children()) { | - | ||||||||||||||||||||||||
350 | if (c->isWindowType()
| 0 | ||||||||||||||||||||||||
351 | updateBlockedStatusRecursion(static_cast<QWindow *>(c), shouldBeBlocked); never executed: updateBlockedStatusRecursion(static_cast<QWindow *>(c), shouldBeBlocked); | 0 | ||||||||||||||||||||||||
352 | } never executed: end of block | 0 | ||||||||||||||||||||||||
353 | } never executed: end of block | 0 | ||||||||||||||||||||||||
354 | } never executed: end of block | 0 | ||||||||||||||||||||||||
355 | - | |||||||||||||||||||||||||
356 | void QGuiApplicationPrivate::updateBlockedStatus(QWindow *window) | - | ||||||||||||||||||||||||
357 | { | - | ||||||||||||||||||||||||
358 | bool shouldBeBlocked = false; | - | ||||||||||||||||||||||||
359 | if (!QWindowPrivate::get(window)->isPopup() && !self->modalWindowList.isEmpty()) | - | ||||||||||||||||||||||||
360 | shouldBeBlocked = self->isWindowBlocked(window); | - | ||||||||||||||||||||||||
361 | updateBlockedStatusRecursion(window, shouldBeBlocked); | - | ||||||||||||||||||||||||
362 | } | - | ||||||||||||||||||||||||
363 | - | |||||||||||||||||||||||||
364 | void QGuiApplicationPrivate::showModalWindow(QWindow *modal) | - | ||||||||||||||||||||||||
365 | { | - | ||||||||||||||||||||||||
366 | self->modalWindowList.prepend(modal); | - | ||||||||||||||||||||||||
367 | - | |||||||||||||||||||||||||
368 | - | |||||||||||||||||||||||||
369 | if (currentMouseWindow && !QWindowPrivate::get(currentMouseWindow)->isPopup()) { | - | ||||||||||||||||||||||||
370 | bool shouldBeBlocked = self->isWindowBlocked(currentMouseWindow); | - | ||||||||||||||||||||||||
371 | if (shouldBeBlocked) { | - | ||||||||||||||||||||||||
372 | - | |||||||||||||||||||||||||
373 | self->modalWindowList.removeFirst(); | - | ||||||||||||||||||||||||
374 | QEvent e(QEvent::Leave); | - | ||||||||||||||||||||||||
375 | QGuiApplication::sendEvent(currentMouseWindow, &e); | - | ||||||||||||||||||||||||
376 | currentMouseWindow = 0; | - | ||||||||||||||||||||||||
377 | self->modalWindowList.prepend(modal); | - | ||||||||||||||||||||||||
378 | } | - | ||||||||||||||||||||||||
379 | } | - | ||||||||||||||||||||||||
380 | - | |||||||||||||||||||||||||
381 | QWindowList windows = QGuiApplication::topLevelWindows(); | - | ||||||||||||||||||||||||
382 | for (int i = 0; i < windows.count(); ++i) { | - | ||||||||||||||||||||||||
383 | QWindow *window = windows.at(i); | - | ||||||||||||||||||||||||
384 | if (!window->d_func()->blockedByModalWindow) | - | ||||||||||||||||||||||||
385 | updateBlockedStatus(window); | - | ||||||||||||||||||||||||
386 | } | - | ||||||||||||||||||||||||
387 | - | |||||||||||||||||||||||||
388 | updateBlockedStatus(modal); | - | ||||||||||||||||||||||||
389 | } | - | ||||||||||||||||||||||||
390 | - | |||||||||||||||||||||||||
391 | void QGuiApplicationPrivate::hideModalWindow(QWindow *window) | - | ||||||||||||||||||||||||
392 | { | - | ||||||||||||||||||||||||
393 | self->modalWindowList.removeAll(window); | - | ||||||||||||||||||||||||
394 | - | |||||||||||||||||||||||||
395 | QWindowList windows = QGuiApplication::topLevelWindows(); | - | ||||||||||||||||||||||||
396 | for (int i = 0; i < windows.count(); ++i) { | - | ||||||||||||||||||||||||
397 | QWindow *window = windows.at(i); | - | ||||||||||||||||||||||||
398 | if (window->d_func()->blockedByModalWindow) | - | ||||||||||||||||||||||||
399 | updateBlockedStatus(window); | - | ||||||||||||||||||||||||
400 | } | - | ||||||||||||||||||||||||
401 | } | - | ||||||||||||||||||||||||
402 | - | |||||||||||||||||||||||||
403 | - | |||||||||||||||||||||||||
404 | - | |||||||||||||||||||||||||
405 | - | |||||||||||||||||||||||||
406 | - | |||||||||||||||||||||||||
407 | - | |||||||||||||||||||||||||
408 | bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWindow) const | - | ||||||||||||||||||||||||
409 | { | - | ||||||||||||||||||||||||
410 | QWindow *unused = 0; | - | ||||||||||||||||||||||||
411 | if (!blockingWindow) | - | ||||||||||||||||||||||||
412 | blockingWindow = &unused; | - | ||||||||||||||||||||||||
413 | - | |||||||||||||||||||||||||
414 | if (modalWindowList.isEmpty()) { | - | ||||||||||||||||||||||||
415 | *blockingWindow = 0; | - | ||||||||||||||||||||||||
416 | return false; | - | ||||||||||||||||||||||||
417 | } | - | ||||||||||||||||||||||||
418 | - | |||||||||||||||||||||||||
419 | for (int i = 0; i < modalWindowList.count(); ++i) { | - | ||||||||||||||||||||||||
420 | QWindow *modalWindow = modalWindowList.at(i); | - | ||||||||||||||||||||||||
421 | - | |||||||||||||||||||||||||
422 | { | - | ||||||||||||||||||||||||
423 | - | |||||||||||||||||||||||||
424 | QWindow *w = window; | - | ||||||||||||||||||||||||
425 | while (w) { | - | ||||||||||||||||||||||||
426 | if (w == modalWindow) { | - | ||||||||||||||||||||||||
427 | *blockingWindow = 0; | - | ||||||||||||||||||||||||
428 | return false; | - | ||||||||||||||||||||||||
429 | } | - | ||||||||||||||||||||||||
430 | QWindow *p = w->parent(); | - | ||||||||||||||||||||||||
431 | if (!p) | - | ||||||||||||||||||||||||
432 | p = w->transientParent(); | - | ||||||||||||||||||||||||
433 | w = p; | - | ||||||||||||||||||||||||
434 | } | - | ||||||||||||||||||||||||
435 | } | - | ||||||||||||||||||||||||
436 | - | |||||||||||||||||||||||||
437 | Qt::WindowModality windowModality = modalWindow->modality(); | - | ||||||||||||||||||||||||
438 | switch (windowModality) { | - | ||||||||||||||||||||||||
439 | case Qt::ApplicationModal: | - | ||||||||||||||||||||||||
440 | { | - | ||||||||||||||||||||||||
441 | if (modalWindow != window) { | - | ||||||||||||||||||||||||
442 | *blockingWindow = modalWindow; | - | ||||||||||||||||||||||||
443 | return true; | - | ||||||||||||||||||||||||
444 | } | - | ||||||||||||||||||||||||
445 | break; | - | ||||||||||||||||||||||||
446 | } | - | ||||||||||||||||||||||||
447 | case Qt::WindowModal: | - | ||||||||||||||||||||||||
448 | { | - | ||||||||||||||||||||||||
449 | QWindow *w = window; | - | ||||||||||||||||||||||||
450 | do { | - | ||||||||||||||||||||||||
451 | QWindow *m = modalWindow; | - | ||||||||||||||||||||||||
452 | do { | - | ||||||||||||||||||||||||
453 | if (m == w) { | - | ||||||||||||||||||||||||
454 | *blockingWindow = m; | - | ||||||||||||||||||||||||
455 | return true; | - | ||||||||||||||||||||||||
456 | } | - | ||||||||||||||||||||||||
457 | QWindow *p = m->parent(); | - | ||||||||||||||||||||||||
458 | if (!p) | - | ||||||||||||||||||||||||
459 | p = m->transientParent(); | - | ||||||||||||||||||||||||
460 | m = p; | - | ||||||||||||||||||||||||
461 | } while (m); | - | ||||||||||||||||||||||||
462 | QWindow *p = w->parent(); | - | ||||||||||||||||||||||||
463 | if (!p) | - | ||||||||||||||||||||||||
464 | p = w->transientParent(); | - | ||||||||||||||||||||||||
465 | w = p; | - | ||||||||||||||||||||||||
466 | } while (w); | - | ||||||||||||||||||||||||
467 | break; | - | ||||||||||||||||||||||||
468 | } | - | ||||||||||||||||||||||||
469 | default: | - | ||||||||||||||||||||||||
470 | ((!(false)) ? qt_assert_x("QGuiApplication", "internal error, a modal widget cannot be modeless",__FILE__,820857) : qt_noop()); | - | ||||||||||||||||||||||||
471 | break; | - | ||||||||||||||||||||||||
472 | } | - | ||||||||||||||||||||||||
473 | } | - | ||||||||||||||||||||||||
474 | *blockingWindow = 0; | - | ||||||||||||||||||||||||
475 | return false; | - | ||||||||||||||||||||||||
476 | } | - | ||||||||||||||||||||||||
477 | - | |||||||||||||||||||||||||
478 | - | |||||||||||||||||||||||||
479 | - | |||||||||||||||||||||||||
480 | - | |||||||||||||||||||||||||
481 | - | |||||||||||||||||||||||||
482 | QWindow *QGuiApplication::focusWindow() | - | ||||||||||||||||||||||||
483 | { | - | ||||||||||||||||||||||||
484 | return QGuiApplicationPrivate::focus_window; | - | ||||||||||||||||||||||||
485 | } | - | ||||||||||||||||||||||||
486 | QObject *QGuiApplication::focusObject() | - | ||||||||||||||||||||||||
487 | { | - | ||||||||||||||||||||||||
488 | if (focusWindow()) | - | ||||||||||||||||||||||||
489 | return focusWindow()->focusObject(); | - | ||||||||||||||||||||||||
490 | return 0; | - | ||||||||||||||||||||||||
491 | } | - | ||||||||||||||||||||||||
492 | QWindowList QGuiApplication::allWindows() | - | ||||||||||||||||||||||||
493 | { | - | ||||||||||||||||||||||||
494 | return QGuiApplicationPrivate::window_list; | - | ||||||||||||||||||||||||
495 | } | - | ||||||||||||||||||||||||
496 | QWindowList QGuiApplication::topLevelWindows() | - | ||||||||||||||||||||||||
497 | { | - | ||||||||||||||||||||||||
498 | const QWindowList &list = QGuiApplicationPrivate::window_list; | - | ||||||||||||||||||||||||
499 | QWindowList topLevelWindows; | - | ||||||||||||||||||||||||
500 | for (int i = 0; i < list.size(); i++) { | - | ||||||||||||||||||||||||
501 | if (!list.at(i)->parent() && list.at(i)->type() != Qt::Desktop) { | - | ||||||||||||||||||||||||
502 | - | |||||||||||||||||||||||||
503 | - | |||||||||||||||||||||||||
504 | const bool embedded = list.at(i)->handle() && list.at(i)->handle()->isEmbedded(); | - | ||||||||||||||||||||||||
505 | if (!embedded) | - | ||||||||||||||||||||||||
506 | topLevelWindows.prepend(list.at(i)); | - | ||||||||||||||||||||||||
507 | } | - | ||||||||||||||||||||||||
508 | } | - | ||||||||||||||||||||||||
509 | return topLevelWindows; | - | ||||||||||||||||||||||||
510 | } | - | ||||||||||||||||||||||||
511 | - | |||||||||||||||||||||||||
512 | QScreen *QGuiApplication::primaryScreen() | - | ||||||||||||||||||||||||
513 | { | - | ||||||||||||||||||||||||
514 | if (QGuiApplicationPrivate::screen_list.isEmpty()) | - | ||||||||||||||||||||||||
515 | return 0; | - | ||||||||||||||||||||||||
516 | return QGuiApplicationPrivate::screen_list.at(0); | - | ||||||||||||||||||||||||
517 | } | - | ||||||||||||||||||||||||
518 | - | |||||||||||||||||||||||||
519 | - | |||||||||||||||||||||||||
520 | - | |||||||||||||||||||||||||
521 | - | |||||||||||||||||||||||||
522 | - | |||||||||||||||||||||||||
523 | QList<QScreen *> QGuiApplication::screens() | - | ||||||||||||||||||||||||
524 | { | - | ||||||||||||||||||||||||
525 | return QGuiApplicationPrivate::screen_list; | - | ||||||||||||||||||||||||
526 | } | - | ||||||||||||||||||||||||
527 | qreal QGuiApplication::devicePixelRatio() const | - | ||||||||||||||||||||||||
528 | { | - | ||||||||||||||||||||||||
529 | - | |||||||||||||||||||||||||
530 | static qreal topDevicePixelRatio = 0.0; | - | ||||||||||||||||||||||||
531 | if (!qFuzzyIsNull(topDevicePixelRatio)
| 0 | ||||||||||||||||||||||||
532 | return never executed: topDevicePixelRatio;return topDevicePixelRatio; never executed: return topDevicePixelRatio; | 0 | ||||||||||||||||||||||||
533 | } | - | ||||||||||||||||||||||||
534 | - | |||||||||||||||||||||||||
535 | topDevicePixelRatio = 1.0; | - | ||||||||||||||||||||||||
536 | for (QForeachContainer<typename QtPrivate::remove_reference<decltypeQScreen *screen : qAsConst(QGuiApplicationPrivate::screen_list)>::type> _container_((QGuiApplicationPrivate::screen_list)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QScreen *screen = *_container_.i; _container_.control; _container_.control = 0) {)) | - | ||||||||||||||||||||||||
537 | topDevicePixelRatio = qMax(topDevicePixelRatio, screen->devicePixelRatio()); never executed: topDevicePixelRatio = qMax(topDevicePixelRatio, screen->devicePixelRatio()); | 0 | ||||||||||||||||||||||||
538 | - | |||||||||||||||||||||||||
539 | }return never executed: topDevicePixelRatio;return topDevicePixelRatio; never executed: return topDevicePixelRatio; | 0 | ||||||||||||||||||||||||
540 | } | - | ||||||||||||||||||||||||
541 | - | |||||||||||||||||||||||||
542 | - | |||||||||||||||||||||||||
543 | - | |||||||||||||||||||||||||
544 | - | |||||||||||||||||||||||||
545 | QWindow *QGuiApplication::topLevelAt(const QPoint &pos) | - | ||||||||||||||||||||||||
546 | { | - | ||||||||||||||||||||||||
547 | const QList<QScreen *> screens = QGuiApplication::screens(); | - | ||||||||||||||||||||||||
548 | if (!screens.isEmpty()
| 0 | ||||||||||||||||||||||||
549 | const QList<QScreen *> primaryScreens = screens.first()->virtualSiblings(); | - | ||||||||||||||||||||||||
550 | QScreen *windowScreen = nullptr; | - | ||||||||||||||||||||||||
for (QForeachContainer<typename QtPrivate::remove_reference<decltype(primaryScreens)>::type> _container_((primaryScreens)); _container_.control && _container_.i != _container_.e; | ||||||||||||||||||||||||||
551 | - | |||||||||||||||||||||||||
552 | - | |||||||||||||||||||||||||
553 | ++_container_.i, _container_.control ^= 1)for (QScreen *screen = *_container_.i; _container_.control; _container_.control = 0: primaryScreens) { | - | ||||||||||||||||||||||||
554 | if (screen->geometry().contains(pos)
| 0 | ||||||||||||||||||||||||
555 | windowScreen = screen; | - | ||||||||||||||||||||||||
556 | break; never executed: break; | 0 | ||||||||||||||||||||||||
557 | } | - | ||||||||||||||||||||||||
558 | } never executed: end of block | 0 | ||||||||||||||||||||||||
559 | - | |||||||||||||||||||||||||
560 | - | |||||||||||||||||||||||||
561 | - | |||||||||||||||||||||||||
562 | - | |||||||||||||||||||||||||
563 | if (!windowScreen
| 0 | ||||||||||||||||||||||||
564 | for (int i = 1; i < screens.size()
| 0 | ||||||||||||||||||||||||
565 | QScreen *screen = screens[.at(i];); | - | ||||||||||||||||||||||||
566 | if (screen->geometry().contains(pos)
| 0 | ||||||||||||||||||||||||
567 | windowScreen = screen; | - | ||||||||||||||||||||||||
568 | break; never executed: break; | 0 | ||||||||||||||||||||||||
569 | } | - | ||||||||||||||||||||||||
570 | } never executed: end of block | 0 | ||||||||||||||||||||||||
571 | } never executed: end of block | 0 | ||||||||||||||||||||||||
572 | - | |||||||||||||||||||||||||
573 | if (windowScreen
| 0 | ||||||||||||||||||||||||
574 | const QPoint devicePosition = QHighDpi::toNativePixels(pos, windowScreen); | - | ||||||||||||||||||||||||
575 | return never executed: windowScreen->handle()->topLevelAt(devicePosition);return windowScreen->handle()->topLevelAt(devicePosition); never executed: return windowScreen->handle()->topLevelAt(devicePosition); | 0 | ||||||||||||||||||||||||
576 | } | - | ||||||||||||||||||||||||
577 | } never executed: end of block | 0 | ||||||||||||||||||||||||
578 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||||||||
579 | } | - | ||||||||||||||||||||||||
580 | QString QGuiApplication::platformName() | - | ||||||||||||||||||||||||
581 | { | - | ||||||||||||||||||||||||
582 | return QGuiApplicationPrivate::platform_name ? | - | ||||||||||||||||||||||||
583 | *QGuiApplicationPrivate::platform_name : QString(); | - | ||||||||||||||||||||||||
584 | } | - | ||||||||||||||||||||||||
585 | - | |||||||||||||||||||||||||
586 | static void init_platform(const QString &pluginArgument, const QString &platformPluginPath, const QString &platformThemeName, int &argc, char **argv) | - | ||||||||||||||||||||||||
587 | { | - | ||||||||||||||||||||||||
588 | - | |||||||||||||||||||||||||
589 | QStringList arguments = pluginArgument.split(QLatin1Char(':')); | - | ||||||||||||||||||||||||
590 | const QString name = arguments.takeFirst().toLower(); | - | ||||||||||||||||||||||||
591 | QString argumentsKey = name; | - | ||||||||||||||||||||||||
592 | argumentsKey[0] = argumentsKey.at(0).toUpper(); | - | ||||||||||||||||||||||||
593 | arguments.append(QLibraryInfo::platformPluginArguments(argumentsKey)); | - | ||||||||||||||||||||||||
594 | - | |||||||||||||||||||||||||
595 | - | |||||||||||||||||||||||||
596 | QGuiApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, arguments, argc, argv, platformPluginPath); | - | ||||||||||||||||||||||||
597 | if (__builtin_expect(!!(!
| 0 | ||||||||||||||||||||||||
QGuiApplicationPrivate::platform_name = new QString(name);
| ||||||||||||||||||||||||||
} else
| ||||||||||||||||||||||||||
598 | QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath); | - | ||||||||||||||||||||||||
599 | - | |||||||||||||||||||||||||
600 | QString fatalMessage | - | ||||||||||||||||||||||||
601 | = ([]() -> QString { enum { Size = sizeof(u"" "This application failed to start because it could not find or load the Qt platform plugin \"%1\"\nin \"%2\".\n\n")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "This application failed to start because it could not find or load the Qt platform plugin \"%1\"\nin \"%2\".\n\n" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()).arg(name, QDir::toNativeSeparators(platformPluginPath)); | - | ||||||||||||||||||||||||
602 | if (!keys.isEmpty()
| 0 | ||||||||||||||||||||||||
603 | fatalMessage += ([]() -> QString { enum { Size = sizeof(u"" "Available platform plugins are: %1.\n\n")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Available platform plugins are: %1.\n\n" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()).arg(return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
604 | keys.join(([]() -> QString { enum { Size = sizeof(u"" ", ")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ", " }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }())));return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
605 | } never executed: end of block | 0 | ||||||||||||||||||||||||
606 | fatalMessage += ([]() -> QString { enum { Size = sizeof(u"" "Reinstalling the application may fix this problem.")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Reinstalling the application may fix this problem." }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }());return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
607 | - | |||||||||||||||||||||||||
608 | - | |||||||||||||||||||||||||
609 | - | |||||||||||||||||||||||||
610 | - | |||||||||||||||||||||||||
611 | - | |||||||||||||||||||||||||
612 | - | |||||||||||||||||||||||||
613 | QMessageLogger(__FILE__, 10871121, __PRETTY_FUNCTION__).fatal("%s", QString(fatalMessage).toLocal8Bit().constData()); | - | ||||||||||||||||||||||||
614 | return; never executed: return; | 0 | ||||||||||||||||||||||||
615 | } | - | ||||||||||||||||||||||||
616 | - | |||||||||||||||||||||||||
617 | QGuiApplicationPrivate::platform_name = new QString(name); | - | ||||||||||||||||||||||||
618 | - | |||||||||||||||||||||||||
619 | - | |||||||||||||||||||||||||
620 | - | |||||||||||||||||||||||||
621 | if (QGuiApplication::primaryScreen()
| 0 | ||||||||||||||||||||||||
622 | QGuiApplicationPrivate::highDpiScalingUpdated = true; | - | ||||||||||||||||||||||||
623 | QHighDpiScaling::updateHighDpiScaling(); | - | ||||||||||||||||||||||||
624 | } never executed: end of block | 0 | ||||||||||||||||||||||||
625 | - | |||||||||||||||||||||||||
626 | - | |||||||||||||||||||||||||
627 | - | |||||||||||||||||||||||||
628 | - | |||||||||||||||||||||||||
629 | QStringList themeNames; | - | ||||||||||||||||||||||||
630 | if (!platformThemeName.isEmpty()
| 0 | ||||||||||||||||||||||||
631 | themeNames.append(platformThemeName); never executed: themeNames.append(platformThemeName); | 0 | ||||||||||||||||||||||||
632 | - | |||||||||||||||||||||||||
633 | - | |||||||||||||||||||||||||
634 | themeNames += QGuiApplicationPrivate::platform_integration->themeNames(); | - | ||||||||||||||||||||||||
635 | - | |||||||||||||||||||||||||
636 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(themeNames)>::type> _container_((themeNames)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (const QString &themeName = *_container_.i; _container_.control; _container_.control = 0): qAsConst(themeNames)) { | - | ||||||||||||||||||||||||
637 | QGuiApplicationPrivate::platform_theme = QPlatformThemeFactory::create(themeName, platformPluginPath); | - | ||||||||||||||||||||||||
638 | if (QGuiApplicationPrivate::platform_theme
| 0 | ||||||||||||||||||||||||
639 | break; never executed: break; | 0 | ||||||||||||||||||||||||
640 | } never executed: end of block | 0 | ||||||||||||||||||||||||
641 | - | |||||||||||||||||||||||||
642 | - | |||||||||||||||||||||||||
643 | - | |||||||||||||||||||||||||
644 | if (!QGuiApplicationPrivate::platform_theme
| 0 | ||||||||||||||||||||||||
645 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(themeNames)>::type> _container_((themeNames)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (const QString &themeName = *_container_.i; _container_.control; _container_.control = 0): qAsConst(themeNames)) { | - | ||||||||||||||||||||||||
646 | QGuiApplicationPrivate::platform_theme = QGuiApplicationPrivate::platform_integration->createPlatformTheme(themeName); | - | ||||||||||||||||||||||||
647 | if (QGuiApplicationPrivate::platform_theme
| 0 | ||||||||||||||||||||||||
648 | break; never executed: break; | 0 | ||||||||||||||||||||||||
649 | } never executed: end of block | 0 | ||||||||||||||||||||||||
650 | - | |||||||||||||||||||||||||
651 | } never executed: end of block | 0 | ||||||||||||||||||||||||
652 | - | |||||||||||||||||||||||||
653 | - | |||||||||||||||||||||||||
654 | if (!QGuiApplicationPrivate::platform_theme
| 0 | ||||||||||||||||||||||||
655 | QGuiApplicationPrivate::platform_theme = new QPlatformTheme; never executed: QGuiApplicationPrivate::platform_theme = new QPlatformTheme; | 0 | ||||||||||||||||||||||||
656 | - | |||||||||||||||||||||||||
657 | - | |||||||||||||||||||||||||
658 | - | |||||||||||||||||||||||||
659 | - | |||||||||||||||||||||||||
660 | if (!arguments.isEmpty()
| 0 | ||||||||||||||||||||||||
661 | if (QObject *nativeInterface = QGuiApplicationPrivate::platform_integration->nativeInterface()
| 0 | ||||||||||||||||||||||||
662 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(arguments)>::type> _container_((arguments)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (const QString &argument = *_container_.i; _container_.control; _container_.control = 0): qAsConst(arguments)) { | - | ||||||||||||||||||||||||
663 | const int equalsPos = argument.indexOf(QLatin1Char('=')); | - | ||||||||||||||||||||||||
664 | const QByteArray name = | - | ||||||||||||||||||||||||
665 | equalsPos != -1
| 0 | ||||||||||||||||||||||||
666 | const QVariant value = | - | ||||||||||||||||||||||||
667 | equalsPos != -1
| 0 | ||||||||||||||||||||||||
668 | nativeInterface->setProperty(name.constData(), value); | - | ||||||||||||||||||||||||
669 | } never executed: end of block | 0 | ||||||||||||||||||||||||
670 | } never executed: end of block | 0 | ||||||||||||||||||||||||
671 | } never executed: end of block | 0 | ||||||||||||||||||||||||
672 | - | |||||||||||||||||||||||||
673 | - | |||||||||||||||||||||||||
674 | fontSmoothingGamma = QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::FontSmoothingGamma).toReal(); | - | ||||||||||||||||||||||||
675 | } never executed: end of block | 0 | ||||||||||||||||||||||||
676 | - | |||||||||||||||||||||||||
677 | static void init_plugins(const QList<QByteArray> &pluginList) | - | ||||||||||||||||||||||||
678 | { | - | ||||||||||||||||||||||||
679 | for (int i = 0; i < pluginList.count(); ++i) { | - | ||||||||||||||||||||||||
680 | QByteArray pluginSpec = pluginList.at(i); | - | ||||||||||||||||||||||||
681 | int colonPos = pluginSpec.indexOf(':'); | - | ||||||||||||||||||||||||
682 | QObject *plugin; | - | ||||||||||||||||||||||||
683 | if (colonPos < 0) | - | ||||||||||||||||||||||||
684 | plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec), QString()); | - | ||||||||||||||||||||||||
685 | else | - | ||||||||||||||||||||||||
686 | plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec.mid(0, colonPos)), | - | ||||||||||||||||||||||||
687 | QLatin1String(pluginSpec.mid(colonPos+1))); | - | ||||||||||||||||||||||||
688 | if (plugin) | - | ||||||||||||||||||||||||
689 | QGuiApplicationPrivate::generic_plugin_list.append(plugin); | - | ||||||||||||||||||||||||
690 | else | - | ||||||||||||||||||||||||
691 | QMessageLogger(__FILE__, 11631199, __PRETTY_FUNCTION__).warning() << "No such plugin for spec " << pluginSpec; | - | ||||||||||||||||||||||||
692 | } | - | ||||||||||||||||||||||||
693 | } | - | ||||||||||||||||||||||||
694 | - | |||||||||||||||||||||||||
695 | void QGuiApplicationPrivate::createPlatformIntegration() | - | ||||||||||||||||||||||||
696 | { | - | ||||||||||||||||||||||||
697 | QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true);QHighDpiScaling::initHighDpiScaling(); | - | ||||||||||||||||||||||||
698 | - | |||||||||||||||||||||||||
699 | - | |||||||||||||||||||||||||
700 | QString platformPluginPath = QString::fromLocal8Bit(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH")); | - | ||||||||||||||||||||||||
701 | - | |||||||||||||||||||||||||
702 | - | |||||||||||||||||||||||||
703 | QByteArray platformName; | - | ||||||||||||||||||||||||
704 | - | |||||||||||||||||||||||||
705 | platformName = "xcb"; | - | ||||||||||||||||||||||||
706 | - | |||||||||||||||||||||||||
707 | QByteArray platformNameEnv = qgetenv("QT_QPA_PLATFORM"); | - | ||||||||||||||||||||||||
708 | if (!platformNameEnv.isEmpty()
| 0 | ||||||||||||||||||||||||
709 | platformName = platformNameEnv; | - | ||||||||||||||||||||||||
710 | } never executed: end of block | 0 | ||||||||||||||||||||||||
711 | - | |||||||||||||||||||||||||
712 | QString platformThemeName = QString::fromLocal8Bit(qgetenv("QT_QPA_PLATFORMTHEME")); | - | ||||||||||||||||||||||||
713 | - | |||||||||||||||||||||||||
714 | - | |||||||||||||||||||||||||
715 | - | |||||||||||||||||||||||||
716 | QString icon; | - | ||||||||||||||||||||||||
717 | - | |||||||||||||||||||||||||
718 | int j = argc
| 0 | ||||||||||||||||||||||||
719 | for (int i=1; i<argc
| 0 | ||||||||||||||||||||||||
720 | if (!argv[i]
| 0 | ||||||||||||||||||||||||
721 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
722 | if (*
| 0 | ||||||||||||||||||||||||
723 | argv[j++] = argv[i]; | - | ||||||||||||||||||||||||
724 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
725 | } | - | ||||||||||||||||||||||||
726 | const bool isXcb = platformName == "xcb"; | - | ||||||||||||||||||||||||
727 | const char *arg = argv[i]; | - | ||||||||||||||||||||||||
728 | if (arg[1] == '-'
| 0 | ||||||||||||||||||||||||
729 | ++ never executed: arg;++arg; never executed: ++arg; | 0 | ||||||||||||||||||||||||
730 | if (strcmp(arg, "-platformpluginpath") == 0
| 0 | ||||||||||||||||||||||||
731 | if (++
| 0 | ||||||||||||||||||||||||
732 | platformPluginPath = QString::fromLocal8Bit(argv[i]); never executed: platformPluginPath = QString::fromLocal8Bit(argv[i]); | 0 | ||||||||||||||||||||||||
733 | } never executed: else if (strcmp(arg, "-platform") == 0end of block
| 0 | ||||||||||||||||||||||||
734 | if (++
| 0 | ||||||||||||||||||||||||
735 | platformName = argv[i]; never executed: platformName = argv[i]; | 0 | ||||||||||||||||||||||||
736 | } never executed: else if (strcmp(arg, "-platformtheme") == 0end of block
| 0 | ||||||||||||||||||||||||
737 | if (++
| 0 | ||||||||||||||||||||||||
738 | platformThemeName = QString::fromLocal8Bit(argv[i]); never executed: platformThemeName = QString::fromLocal8Bit(argv[i]); | 0 | ||||||||||||||||||||||||
739 | } never executed: else if (strcmp(arg, "-qwindowgeometry") == 0end of block
| 0 | ||||||||||||||||||||||||
740 | if (++
| 0 | ||||||||||||||||||||||||
741 | windowGeometrySpecification = QWindowGeometrySpecification::fromArgument(argv[i]); never executed: windowGeometrySpecification = QWindowGeometrySpecification::fromArgument(argv[i]); | 0 | ||||||||||||||||||||||||
742 | } never executed: else if (strcmp(arg, "-qwindowtitle") == 0end of block
| 0 | ||||||||||||||||||||||||
743 | if (++
| 0 | ||||||||||||||||||||||||
744 | firstWindowTitle = QString::fromLocal8Bit(argv[i]); never executed: firstWindowTitle = QString::fromLocal8Bit(argv[i]); | 0 | ||||||||||||||||||||||||
745 | } never executed: else if (strcmp(arg, "-qwindowicon") == 0end of block
| 0 | ||||||||||||||||||||||||
746 | if (++
| 0 | ||||||||||||||||||||||||
747 | icon = QString::fromLocal8Bit(argv[i]); | - | ||||||||||||||||||||||||
748 | } never executed: end of block | 0 | ||||||||||||||||||||||||
749 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
750 | argv[j++] = argv[i]; | - | ||||||||||||||||||||||||
751 | } never executed: end of block | 0 | ||||||||||||||||||||||||
752 | } | - | ||||||||||||||||||||||||
753 | - | |||||||||||||||||||||||||
754 | if (j < argc
| 0 | ||||||||||||||||||||||||
755 | argv[j] = 0; | - | ||||||||||||||||||||||||
756 | argc = j; | - | ||||||||||||||||||||||||
757 | } never executed: end of block | 0 | ||||||||||||||||||||||||
758 | - | |||||||||||||||||||||||||
759 | init_platform(QLatin1String(platformName), platformPluginPath, platformThemeName, argc, argv); | - | ||||||||||||||||||||||||
760 | - | |||||||||||||||||||||||||
761 | if (!icon.isEmpty()
| 0 | ||||||||||||||||||||||||
762 | forcedWindowIcon = QDir::isAbsolutePath(icon)
never executed: forcedWindowIcon = QDir::isAbsolutePath(icon) ? QIcon(icon) : QIcon::fromTheme(icon); | 0 | ||||||||||||||||||||||||
763 | } never executed: end of block | 0 | ||||||||||||||||||||||||
764 | - | |||||||||||||||||||||||||
765 | - | |||||||||||||||||||||||||
766 | - | |||||||||||||||||||||||||
767 | - | |||||||||||||||||||||||||
768 | - | |||||||||||||||||||||||||
769 | - | |||||||||||||||||||||||||
770 | - | |||||||||||||||||||||||||
771 | void QGuiApplicationPrivate::createEventDispatcher() | - | ||||||||||||||||||||||||
772 | { | - | ||||||||||||||||||||||||
773 | ((!(!eventDispatcher)) ? qt_assert("!eventDispatcher",__FILE__,12511281) : qt_noop()); | - | ||||||||||||||||||||||||
774 | - | |||||||||||||||||||||||||
775 | if (platform_integration == 0) | - | ||||||||||||||||||||||||
776 | createPlatformIntegration(); | - | ||||||||||||||||||||||||
777 | - | |||||||||||||||||||||||||
778 | - | |||||||||||||||||||||||||
779 | ((!(!eventDispatcher)) ? qt_assert("!eventDispatcher",__FILE__,12571287) : qt_noop()); | - | ||||||||||||||||||||||||
780 | - | |||||||||||||||||||||||||
781 | eventDispatcher = platform_integration->createEventDispatcher(); | - | ||||||||||||||||||||||||
782 | } | - | ||||||||||||||||||||||||
783 | - | |||||||||||||||||||||||||
784 | void QGuiApplicationPrivate::eventDispatcherReady() | - | ||||||||||||||||||||||||
785 | { | - | ||||||||||||||||||||||||
786 | if (platform_integration == 0) | - | ||||||||||||||||||||||||
787 | createPlatformIntegration(); | - | ||||||||||||||||||||||||
788 | - | |||||||||||||||||||||||||
789 | platform_integration->initialize(); | - | ||||||||||||||||||||||||
790 | - | |||||||||||||||||||||||||
791 | - | |||||||||||||||||||||||||
792 | - | |||||||||||||||||||||||||
793 | if (!QGuiApplicationPrivate::highDpiScalingUpdated) | - | ||||||||||||||||||||||||
794 | QHighDpiScaling::updateHighDpiScaling(); | - | ||||||||||||||||||||||||
795 | } | - | ||||||||||||||||||||||||
796 | - | |||||||||||||||||||||||||
797 | void QGuiApplicationPrivate::init() | - | ||||||||||||||||||||||||
798 | { | - | ||||||||||||||||||||||||
799 | QCoreApplicationPrivate::init(); | - | ||||||||||||||||||||||||
800 | - | |||||||||||||||||||||||||
801 | QCoreApplicationPrivate::is_app_running = false; | - | ||||||||||||||||||||||||
802 | - | |||||||||||||||||||||||||
803 | bool loadTestability = false; | - | ||||||||||||||||||||||||
804 | QList<QByteArray> pluginList; | - | ||||||||||||||||||||||||
805 | - | |||||||||||||||||||||||||
806 | - | |||||||||||||||||||||||||
807 | QString session_id; | - | ||||||||||||||||||||||||
808 | QString session_key; | - | ||||||||||||||||||||||||
809 | QString s; | - | ||||||||||||||||||||||||
810 | int j = argc
| 0 | ||||||||||||||||||||||||
811 | for (int i=1; i<argc
| 0 | ||||||||||||||||||||||||
812 | if (!argv[i]
| 0 | ||||||||||||||||||||||||
813 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
814 | if (*
| 0 | ||||||||||||||||||||||||
815 | argv[j++] = argv[i]; | - | ||||||||||||||||||||||||
816 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
817 | } | - | ||||||||||||||||||||||||
818 | const char *arg = argv[i]; | - | ||||||||||||||||||||||||
819 | if (arg[1] == '-'
| 0 | ||||||||||||||||||||||||
820 | ++ never executed: arg;++arg; never executed: ++arg; | 0 | ||||||||||||||||||||||||
821 | if (strcmp(arg, "-plugin") == 0
| 0 | ||||||||||||||||||||||||
822 | if (++
| 0 | ||||||||||||||||||||||||
823 | pluginList << argv[i]; never executed: pluginList << argv[i]; | 0 | ||||||||||||||||||||||||
824 | } never executed: else if (strcmp(arg, "-reverse") == 0end of block
| 0 | ||||||||||||||||||||||||
825 | force_reverse = true; | - | ||||||||||||||||||||||||
826 | } never executed: else if (strcmp(arg, "-session") == 0end of block
| 0 | ||||||||||||||||||||||||
827 | ++i; | - | ||||||||||||||||||||||||
828 | if (argv[i]
| 0 | ||||||||||||||||||||||||
829 | session_id = QString::fromLatin1(argv[i]); | - | ||||||||||||||||||||||||
830 | int p = session_id.indexOf(QLatin1Char('_')); | - | ||||||||||||||||||||||||
831 | if (p >= 0
| 0 | ||||||||||||||||||||||||
832 | session_key = session_id.mid(p +1); | - | ||||||||||||||||||||||||
833 | session_id = session_id.left(p); | - | ||||||||||||||||||||||||
834 | } never executed: end of block | 0 | ||||||||||||||||||||||||
835 | is_session_restored = true; | - | ||||||||||||||||||||||||
836 | } never executed: end of block | 0 | ||||||||||||||||||||||||
837 | - | |||||||||||||||||||||||||
838 | } never executed: else if (strcmp(arg, "-testability") == 0end of block
| 0 | ||||||||||||||||||||||||
839 | loadTestability = true; | - | ||||||||||||||||||||||||
840 | } never executed: else if (strncmp(arg, "-style=", 7) == 0end of block
| 0 | ||||||||||||||||||||||||
841 | s = QString::fromLocal8Bit(arg + 7).toLower();); | - | ||||||||||||||||||||||||
842 | } never executed: else if (strcmp(arg, "-style") == 0end of block
| 0 | ||||||||||||||||||||||||
843 | s = QString::fromLocal8Bit(argv[++i]).toLower();]); | - | ||||||||||||||||||||||||
844 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
845 | argv[j++] = argv[i]; | - | ||||||||||||||||||||||||
846 | } never executed: end of block | 0 | ||||||||||||||||||||||||
847 | - | |||||||||||||||||||||||||
848 | if (!s.isEmpty()
| 0 | ||||||||||||||||||||||||
849 | styleOverride = s; never executed: styleOverride = s; | 0 | ||||||||||||||||||||||||
850 | } never executed: end of block | 0 | ||||||||||||||||||||||||
851 | - | |||||||||||||||||||||||||
852 | if (j < argc
| 0 | ||||||||||||||||||||||||
853 | argv[j] = 0; | - | ||||||||||||||||||||||||
854 | argc = j; | - | ||||||||||||||||||||||||
855 | } never executed: end of block | 0 | ||||||||||||||||||||||||
856 | - | |||||||||||||||||||||||||
857 | - | |||||||||||||||||||||||||
858 | QByteArray envPlugins = qgetenv("QT_QPA_GENERIC_PLUGINS"); | - | ||||||||||||||||||||||||
859 | if (!envPlugins.isEmpty()
| 0 | ||||||||||||||||||||||||
860 | { | 0 | ||||||||||||||||||||||||
for (QForeachContainer<typename QtPrivate::remove_reference<decltype(envPlugins.split(','))>::type> _container_((pluginList += never executed: envPlugins.split(','))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QByteArray &plugin = *_container_.i; _container_.control; _container_.control = 0)pluginList += envPlugins.split(','); never executed: pluginList += envPlugins.split(','); | ||||||||||||||||||||||||||
pluginList << plugin; never executed: pluginList += envPlugins.split(','); | ||||||||||||||||||||||||||
} never executed: pluginList += envPlugins.split(','); never executed: );pluginList += envPlugins.split(','); never executed: pluginList += envPlugins.split(','); | ||||||||||||||||||||||||||
861 | - | |||||||||||||||||||||||||
862 | if (platform_integration == 0
| 0 | ||||||||||||||||||||||||
863 | createPlatformIntegration(); never executed: createPlatformIntegration(); | 0 | ||||||||||||||||||||||||
864 | - | |||||||||||||||||||||||||
865 | initPalette(); | - | ||||||||||||||||||||||||
866 | QFont::initialize(); | - | ||||||||||||||||||||||||
867 | - | |||||||||||||||||||||||||
868 | mouse_double_click_distance = platformTheme()->themeHint(QPlatformTheme::MouseDoubleClickDistance).toInt(); | - | ||||||||||||||||||||||||
869 | - | |||||||||||||||||||||||||
870 | - | |||||||||||||||||||||||||
871 | QCursorData::initialize(); | - | ||||||||||||||||||||||||
872 | - | |||||||||||||||||||||||||
873 | - | |||||||||||||||||||||||||
874 | - | |||||||||||||||||||||||||
875 | qRegisterGuiVariant(); | - | ||||||||||||||||||||||||
876 | - | |||||||||||||||||||||||||
877 | - | |||||||||||||||||||||||||
878 | - | |||||||||||||||||||||||||
879 | qRegisterGuiGetInterpolator(); | - | ||||||||||||||||||||||||
880 | - | |||||||||||||||||||||||||
881 | - | |||||||||||||||||||||||||
882 | - | |||||||||||||||||||||||||
883 | - | |||||||||||||||||||||||||
884 | if ((static_cast<
| 0 | ||||||||||||||||||||||||
885 | QOpenGLContext *ctx = new QOpenGLContext; | - | ||||||||||||||||||||||||
886 | ctx->setFormat(QSurfaceFormat::defaultFormat()); | - | ||||||||||||||||||||||||
887 | ctx->create(); | - | ||||||||||||||||||||||||
888 | qt_gl_set_global_share_context(ctx); | - | ||||||||||||||||||||||||
889 | ownGlobalShareContext = true; | - | ||||||||||||||||||||||||
890 | } never executed: end of block | 0 | ||||||||||||||||||||||||
891 | - | |||||||||||||||||||||||||
892 | - | |||||||||||||||||||||||||
893 | QWindowSystemInterfacePrivate::eventTime.start(); | - | ||||||||||||||||||||||||
894 | - | |||||||||||||||||||||||||
895 | is_app_running = true; | - | ||||||||||||||||||||||||
896 | init_plugins(pluginList); | - | ||||||||||||||||||||||||
897 | QWindowSystemInterface::flushWindowSystemEvents(); | - | ||||||||||||||||||||||||
898 | - | |||||||||||||||||||||||||
899 | - | |||||||||||||||||||||||||
900 | QGuiApplication * const q = q_func(); | - | ||||||||||||||||||||||||
901 | - | |||||||||||||||||||||||||
902 | - | |||||||||||||||||||||||||
903 | session_manager = new QSessionManager(q, session_id, session_key); | - | ||||||||||||||||||||||||
904 | - | |||||||||||||||||||||||||
905 | - | |||||||||||||||||||||||||
906 | - | |||||||||||||||||||||||||
907 | if (qEnvironmentVariableIntValue("QT_LOAD_TESTABILITY") > 0
| 0 | ||||||||||||||||||||||||
908 | loadTestability = true; never executed: loadTestability = true; | 0 | ||||||||||||||||||||||||
909 | - | |||||||||||||||||||||||||
910 | if (loadTestability
| 0 | ||||||||||||||||||||||||
911 | QLibrary testLib(([]() -> QString { enum { Size = sizeof(u"" "qttestability")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "qttestability" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); | - | ||||||||||||||||||||||||
912 | if (__builtin_expect(!!(!
| 0 | ||||||||||||||||||||||||
913 | QMessageLogger(__FILE__, 1445, __PRETTY_FUNCTION__).critical() << "Library qttestability load failed:" << testLib.errorString(); | - | ||||||||||||||||||||||||
914 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
915 | typedef void (*TasInitialize)(void); | - | ||||||||||||||||||||||||
916 | TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init"); | - | ||||||||||||||||||||||||
917 | if (initFunction) {__builtin_expect(!!(!
| 0 | ||||||||||||||||||||||||
} else
| ||||||||||||||||||||||||||
918 | QMessageLogger(__FILE__, 14221450, __PRETTY_FUNCTION__).critical() << ("Library qttestability resolve failed!"; | - | ||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||
919 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
920 | QMessageLogger(__FILE__, 1425, __PRETTY_FUNCTION__).critical() << "Library qttestability load failed:" << testLib.errorStringinitFunction(); | - | ||||||||||||||||||||||||
921 | } never executed: end of block | 0 | ||||||||||||||||||||||||
922 | } | - | ||||||||||||||||||||||||
923 | } | - | ||||||||||||||||||||||||
924 | - | |||||||||||||||||||||||||
925 | - | |||||||||||||||||||||||||
926 | - | |||||||||||||||||||||||||
927 | - | |||||||||||||||||||||||||
928 | if (layout_direction == Qt::LayoutDirectionAuto
| 0 | ||||||||||||||||||||||||
929 | QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight); never executed: QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight); | 0 | ||||||||||||||||||||||||
scrollNoPhaseAllowed = qEnvironmentVariableIsSet("QT_ENABLE_MOUSE_WHEEL_TRACKING" never executed: QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight); never executed: );QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight); never executed: QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight); | ||||||||||||||||||||||||||
930 | } never executed: end of block | 0 | ||||||||||||||||||||||||
931 | - | |||||||||||||||||||||||||
932 | extern void qt_cleanupFontDatabase(); | - | ||||||||||||||||||||||||
933 | - | |||||||||||||||||||||||||
934 | QGuiApplicationPrivate::~QGuiApplicationPrivate() | - | ||||||||||||||||||||||||
935 | { | - | ||||||||||||||||||||||||
936 | is_app_closing = true; | - | ||||||||||||||||||||||||
937 | is_app_running = false; | - | ||||||||||||||||||||||||
938 | - | |||||||||||||||||||||||||
939 | for (int i = 0; i < generic_plugin_list.count(); ++i) | - | ||||||||||||||||||||||||
940 | delete generic_plugin_list.at(i); | - | ||||||||||||||||||||||||
941 | generic_plugin_list.clear(); | - | ||||||||||||||||||||||||
942 | - | |||||||||||||||||||||||||
943 | clearFontUnlocked(); | - | ||||||||||||||||||||||||
944 | - | |||||||||||||||||||||||||
945 | QFont::cleanup(); | - | ||||||||||||||||||||||||
946 | - | |||||||||||||||||||||||||
947 | - | |||||||||||||||||||||||||
948 | QCursorData::cleanup(); | - | ||||||||||||||||||||||||
949 | - | |||||||||||||||||||||||||
950 | - | |||||||||||||||||||||||||
951 | layout_direction = Qt::LeftToRight; | - | ||||||||||||||||||||||||
952 | - | |||||||||||||||||||||||||
953 | cleanupThreadData(); | - | ||||||||||||||||||||||||
954 | - | |||||||||||||||||||||||||
955 | delete QGuiApplicationPrivate::styleHints; | - | ||||||||||||||||||||||||
956 | QGuiApplicationPrivate::styleHints = nullptr; | - | ||||||||||||||||||||||||
957 | delete inputMethod; | - | ||||||||||||||||||||||||
958 | - | |||||||||||||||||||||||||
959 | qt_cleanupFontDatabase(); | - | ||||||||||||||||||||||||
960 | - | |||||||||||||||||||||||||
961 | QPixmapCache::clear(); | - | ||||||||||||||||||||||||
962 | - | |||||||||||||||||||||||||
963 | - | |||||||||||||||||||||||||
964 | if (ownGlobalShareContext) { | - | ||||||||||||||||||||||||
965 | delete qt_gl_global_share_context(); | - | ||||||||||||||||||||||||
966 | qt_gl_set_global_share_context(0); | - | ||||||||||||||||||||||||
967 | } | - | ||||||||||||||||||||||||
968 | - | |||||||||||||||||||||||||
969 | - | |||||||||||||||||||||||||
970 | platform_integration->destroy(); | - | ||||||||||||||||||||||||
971 | - | |||||||||||||||||||||||||
972 | delete platform_theme; | - | ||||||||||||||||||||||||
973 | platform_theme = 0; | - | ||||||||||||||||||||||||
974 | delete platform_integration; | - | ||||||||||||||||||||||||
975 | platform_integration = 0; | - | ||||||||||||||||||||||||
976 | delete m_gammaTables.load(); | - | ||||||||||||||||||||||||
977 | - | |||||||||||||||||||||||||
978 | window_list.clear(); | - | ||||||||||||||||||||||||
979 | } | - | ||||||||||||||||||||||||
980 | Qt::KeyboardModifiers QGuiApplication::keyboardModifiers() | - | ||||||||||||||||||||||||
981 | { | - | ||||||||||||||||||||||||
982 | return QGuiApplicationPrivate::modifier_buttons; | - | ||||||||||||||||||||||||
983 | } | - | ||||||||||||||||||||||||
984 | Qt::KeyboardModifiers QGuiApplication::queryKeyboardModifiers() | - | ||||||||||||||||||||||||
985 | { | - | ||||||||||||||||||||||||
986 | if (__builtin_expect(!!(QCoreApplication::instance()), true)) { } else { QMessageLogger(__FILE__, 15421568, __PRETTY_FUNCTION__).warning("Must construct a QGuiApplication first."); return Qt::KeyboardModifiers(0); } | - | ||||||||||||||||||||||||
987 | QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration(); | - | ||||||||||||||||||||||||
988 | return pi->queryKeyboardModifiers(); | - | ||||||||||||||||||||||||
989 | } | - | ||||||||||||||||||||||||
990 | Qt::MouseButtons QGuiApplication::mouseButtons() | - | ||||||||||||||||||||||||
991 | { | - | ||||||||||||||||||||||||
992 | return QGuiApplicationPrivate::mouse_buttons; | - | ||||||||||||||||||||||||
993 | } | - | ||||||||||||||||||||||||
994 | - | |||||||||||||||||||||||||
995 | - | |||||||||||||||||||||||||
996 | - | |||||||||||||||||||||||||
997 | - | |||||||||||||||||||||||||
998 | - | |||||||||||||||||||||||||
999 | QPlatformNativeInterface *QGuiApplication::platformNativeInterface() | - | ||||||||||||||||||||||||
1000 | { | - | ||||||||||||||||||||||||
1001 | QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration(); | - | ||||||||||||||||||||||||
1002 | return pi ? pi->nativeInterface() : 0; | - | ||||||||||||||||||||||||
1003 | } | - | ||||||||||||||||||||||||
1004 | - | |||||||||||||||||||||||||
1005 | - | |||||||||||||||||||||||||
1006 | - | |||||||||||||||||||||||||
1007 | - | |||||||||||||||||||||||||
1008 | QFunctionPointer QGuiApplication::platformFunction(const QByteArray &function) | - | ||||||||||||||||||||||||
1009 | { | - | ||||||||||||||||||||||||
1010 | QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration(); | - | ||||||||||||||||||||||||
1011 | if (!pi
| 0 | ||||||||||||||||||||||||
1012 | QMessageLogger(__FILE__, 15821608, __PRETTY_FUNCTION__).warning() << ("QGuiApplication::platformFunction(): Must construct a QGuiApplication before accessing a platform function";); | - | ||||||||||||||||||||||||
1013 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||||||||
1014 | } | - | ||||||||||||||||||||||||
1015 | - | |||||||||||||||||||||||||
1016 | return never executed: pi->nativeInterface() ? pi->nativeInterface()->platformFunction(function) : nullptr;return pi->nativeInterface() ? pi->nativeInterface()->platformFunction(function) : nullptr; never executed: return pi->nativeInterface() ? pi->nativeInterface()->platformFunction(function) : nullptr; | 0 | ||||||||||||||||||||||||
1017 | } | - | ||||||||||||||||||||||||
1018 | int QGuiApplication::exec() | - | ||||||||||||||||||||||||
1019 | { | - | ||||||||||||||||||||||||
1020 | - | |||||||||||||||||||||||||
1021 | QAccessible::setRootObject((static_cast<QGuiApplication *>(QCoreApplication::instance()))); | - | ||||||||||||||||||||||||
1022 | - | |||||||||||||||||||||||||
1023 | return QCoreApplication::exec(); | - | ||||||||||||||||||||||||
1024 | } | - | ||||||||||||||||||||||||
1025 | - | |||||||||||||||||||||||||
1026 | - | |||||||||||||||||||||||||
1027 | - | |||||||||||||||||||||||||
1028 | bool QGuiApplication::notify(QObject *object, QEvent *event) | - | ||||||||||||||||||||||||
1029 | { | - | ||||||||||||||||||||||||
1030 | if (object->isWindowType()) | - | ||||||||||||||||||||||||
1031 | QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(static_cast<QWindow *>(object), event); | - | ||||||||||||||||||||||||
1032 | return QCoreApplication::notify(object, event); | - | ||||||||||||||||||||||||
1033 | } | - | ||||||||||||||||||||||||
1034 | - | |||||||||||||||||||||||||
1035 | - | |||||||||||||||||||||||||
1036 | - | |||||||||||||||||||||||||
1037 | bool QGuiApplication::event(QEvent *e) | - | ||||||||||||||||||||||||
1038 | { | - | ||||||||||||||||||||||||
1039 | if(e->type() == QEvent::LanguageChange) { | - | ||||||||||||||||||||||||
1040 | setLayoutDirection(qt_detectRTLLanguage()?Qt::RightToLeft:Qt::LeftToRight); | - | ||||||||||||||||||||||||
1041 | } | - | ||||||||||||||||||||||||
1042 | return QCoreApplication::event(e); | - | ||||||||||||||||||||||||
1043 | } | - | ||||||||||||||||||||||||
1044 | - | |||||||||||||||||||||||||
1045 | - | |||||||||||||||||||||||||
1046 | - | |||||||||||||||||||||||||
1047 | - | |||||||||||||||||||||||||
1048 | bool QGuiApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventList *postedEvents) | - | ||||||||||||||||||||||||
1049 | { | - | ||||||||||||||||||||||||
1050 | return QCoreApplication::compressEvent(event, receiver, postedEvents); | - | ||||||||||||||||||||||||
1051 | } | - | ||||||||||||||||||||||||
1052 | - | |||||||||||||||||||||||||
1053 | void QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(QWindow *window, QEvent *event) | - | ||||||||||||||||||||||||
1054 | { | - | ||||||||||||||||||||||||
1055 | if (!window) | - | ||||||||||||||||||||||||
1056 | return; | - | ||||||||||||||||||||||||
1057 | QPlatformWindow *platformWindow = window->handle(); | - | ||||||||||||||||||||||||
1058 | if (!platformWindow) | - | ||||||||||||||||||||||||
1059 | return; | - | ||||||||||||||||||||||||
1060 | - | |||||||||||||||||||||||||
1061 | if (event->spontaneous()) | - | ||||||||||||||||||||||||
1062 | return; | - | ||||||||||||||||||||||||
1063 | - | |||||||||||||||||||||||||
1064 | platformWindow->windowEvent(event); | - | ||||||||||||||||||||||||
1065 | } | - | ||||||||||||||||||||||||
1066 | - | |||||||||||||||||||||||||
1067 | bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result) | - | ||||||||||||||||||||||||
1068 | { | - | ||||||||||||||||||||||||
1069 | return window->nativeEvent(eventType, message, result); | - | ||||||||||||||||||||||||
1070 | } | - | ||||||||||||||||||||||||
1071 | - | |||||||||||||||||||||||||
1072 | void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e) | - | ||||||||||||||||||||||||
1073 | { | - | ||||||||||||||||||||||||
1074 | switch(e->type) { | - | ||||||||||||||||||||||||
1075 | case QWindowSystemInterfacePrivate::FrameStrutMouse: | - | ||||||||||||||||||||||||
1076 | case QWindowSystemInterfacePrivate::Mouse: | - | ||||||||||||||||||||||||
1077 | QGuiApplicationPrivate::processMouseEvent(static_cast<QWindowSystemInterfacePrivate::MouseEvent *>(e)); | - | ||||||||||||||||||||||||
1078 | break; | - | ||||||||||||||||||||||||
1079 | case QWindowSystemInterfacePrivate::Wheel: | - | ||||||||||||||||||||||||
1080 | QGuiApplicationPrivate::processWheelEvent(static_cast<QWindowSystemInterfacePrivate::WheelEvent *>(e)); | - | ||||||||||||||||||||||||
1081 | break; | - | ||||||||||||||||||||||||
1082 | case QWindowSystemInterfacePrivate::Key: | - | ||||||||||||||||||||||||
1083 | QGuiApplicationPrivate::processKeyEvent(static_cast<QWindowSystemInterfacePrivate::KeyEvent *>(e)); | - | ||||||||||||||||||||||||
1084 | break; | - | ||||||||||||||||||||||||
1085 | case QWindowSystemInterfacePrivate::Touch: | - | ||||||||||||||||||||||||
1086 | QGuiApplicationPrivate::processTouchEvent(static_cast<QWindowSystemInterfacePrivate::TouchEvent *>(e)); | - | ||||||||||||||||||||||||
1087 | break; | - | ||||||||||||||||||||||||
1088 | case QWindowSystemInterfacePrivate::GeometryChange: | - | ||||||||||||||||||||||||
1089 | QGuiApplicationPrivate::processGeometryChangeEvent(static_cast<QWindowSystemInterfacePrivate::GeometryChangeEvent*>(e)); | - | ||||||||||||||||||||||||
1090 | break; | - | ||||||||||||||||||||||||
1091 | case QWindowSystemInterfacePrivate::Enter: | - | ||||||||||||||||||||||||
1092 | QGuiApplicationPrivate::processEnterEvent(static_cast<QWindowSystemInterfacePrivate::EnterEvent *>(e)); | - | ||||||||||||||||||||||||
1093 | break; | - | ||||||||||||||||||||||||
1094 | case QWindowSystemInterfacePrivate::Leave: | - | ||||||||||||||||||||||||
1095 | QGuiApplicationPrivate::processLeaveEvent(static_cast<QWindowSystemInterfacePrivate::LeaveEvent *>(e)); | - | ||||||||||||||||||||||||
1096 | break; | - | ||||||||||||||||||||||||
1097 | case QWindowSystemInterfacePrivate::ActivatedWindow: | - | ||||||||||||||||||||||||
1098 | QGuiApplicationPrivate::processActivatedEvent(static_cast<QWindowSystemInterfacePrivate::ActivatedWindowEvent *>(e)); | - | ||||||||||||||||||||||||
1099 | break; | - | ||||||||||||||||||||||||
1100 | case QWindowSystemInterfacePrivate::WindowStateChanged: | - | ||||||||||||||||||||||||
1101 | QGuiApplicationPrivate::processWindowStateChangedEvent(static_cast<QWindowSystemInterfacePrivate::WindowStateChangedEvent *>(e)); | - | ||||||||||||||||||||||||
1102 | break; | - | ||||||||||||||||||||||||
1103 | case QWindowSystemInterfacePrivate::WindowScreenChanged: | - | ||||||||||||||||||||||||
1104 | QGuiApplicationPrivate::processWindowScreenChangedEvent(static_cast<QWindowSystemInterfacePrivate::WindowScreenChangedEvent *>(e)); | - | ||||||||||||||||||||||||
1105 | break; | - | ||||||||||||||||||||||||
1106 | case QWindowSystemInterfacePrivate::ApplicationStateChanged: { | - | ||||||||||||||||||||||||
1107 | QWindowSystemInterfacePrivate::ApplicationStateChangedEvent * changeEvent = static_cast<QWindowSystemInterfacePrivate::ApplicationStateChangedEvent *>(e); | - | ||||||||||||||||||||||||
1108 | QGuiApplicationPrivate::setApplicationState(changeEvent->newState, changeEvent->forcePropagate); } | - | ||||||||||||||||||||||||
1109 | break; | - | ||||||||||||||||||||||||
1110 | case QWindowSystemInterfacePrivate::FlushEvents: { | - | ||||||||||||||||||||||||
1111 | QWindowSystemInterfacePrivate::FlushEventsEvent *flushEventsEvent = static_cast<QWindowSystemInterfacePrivate::FlushEventsEvent *>(e); | - | ||||||||||||||||||||||||
1112 | QWindowSystemInterface::deferredFlushWindowSystemEvents(flushEventsEvent->flags); } | - | ||||||||||||||||||||||||
1113 | break; | - | ||||||||||||||||||||||||
1114 | case QWindowSystemInterfacePrivate::Close: | - | ||||||||||||||||||||||||
1115 | QGuiApplicationPrivate::processCloseEvent( | - | ||||||||||||||||||||||||
1116 | static_cast<QWindowSystemInterfacePrivate::CloseEvent *>(e)); | - | ||||||||||||||||||||||||
1117 | break; | - | ||||||||||||||||||||||||
1118 | case QWindowSystemInterfacePrivate::ScreenOrientation: | - | ||||||||||||||||||||||||
1119 | QGuiApplicationPrivate::reportScreenOrientationChange( | - | ||||||||||||||||||||||||
1120 | static_cast<QWindowSystemInterfacePrivate::ScreenOrientationEvent *>(e)); | - | ||||||||||||||||||||||||
1121 | break; | - | ||||||||||||||||||||||||
1122 | case QWindowSystemInterfacePrivate::ScreenGeometry: | - | ||||||||||||||||||||||||
1123 | QGuiApplicationPrivate::reportGeometryChange( | - | ||||||||||||||||||||||||
1124 | static_cast<QWindowSystemInterfacePrivate::ScreenGeometryEvent *>(e)); | - | ||||||||||||||||||||||||
1125 | break; | - | ||||||||||||||||||||||||
1126 | case QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInch: | - | ||||||||||||||||||||||||
1127 | QGuiApplicationPrivate::reportLogicalDotsPerInchChange( | - | ||||||||||||||||||||||||
1128 | static_cast<QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *>(e)); | - | ||||||||||||||||||||||||
1129 | break; | - | ||||||||||||||||||||||||
1130 | case QWindowSystemInterfacePrivate::ScreenRefreshRate: | - | ||||||||||||||||||||||||
1131 | QGuiApplicationPrivate::reportRefreshRateChange( | - | ||||||||||||||||||||||||
1132 | static_cast<QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *>(e)); | - | ||||||||||||||||||||||||
1133 | break; | - | ||||||||||||||||||||||||
1134 | case QWindowSystemInterfacePrivate::ThemeChange: | - | ||||||||||||||||||||||||
1135 | QGuiApplicationPrivate::processThemeChanged( | - | ||||||||||||||||||||||||
1136 | static_cast<QWindowSystemInterfacePrivate::ThemeChangeEvent *>(e)); | - | ||||||||||||||||||||||||
1137 | break; | - | ||||||||||||||||||||||||
1138 | case QWindowSystemInterfacePrivate::Expose: | - | ||||||||||||||||||||||||
1139 | QGuiApplicationPrivate::processExposeEvent(static_cast<QWindowSystemInterfacePrivate::ExposeEvent *>(e)); | - | ||||||||||||||||||||||||
1140 | break; | - | ||||||||||||||||||||||||
1141 | case QWindowSystemInterfacePrivate::Tablet: | - | ||||||||||||||||||||||||
1142 | QGuiApplicationPrivate::processTabletEvent( | - | ||||||||||||||||||||||||
1143 | static_cast<QWindowSystemInterfacePrivate::TabletEvent *>(e)); | - | ||||||||||||||||||||||||
1144 | break; | - | ||||||||||||||||||||||||
1145 | case QWindowSystemInterfacePrivate::TabletEnterProximity: | - | ||||||||||||||||||||||||
1146 | QGuiApplicationPrivate::processTabletEnterProximityEvent( | - | ||||||||||||||||||||||||
1147 | static_cast<QWindowSystemInterfacePrivate::TabletEnterProximityEvent *>(e)); | - | ||||||||||||||||||||||||
1148 | break; | - | ||||||||||||||||||||||||
1149 | case QWindowSystemInterfacePrivate::TabletLeaveProximity: | - | ||||||||||||||||||||||||
1150 | QGuiApplicationPrivate::processTabletLeaveProximityEvent( | - | ||||||||||||||||||||||||
1151 | static_cast<QWindowSystemInterfacePrivate::TabletLeaveProximityEvent *>(e)); | - | ||||||||||||||||||||||||
1152 | break; | - | ||||||||||||||||||||||||
1153 | - | |||||||||||||||||||||||||
1154 | case QWindowSystemInterfacePrivate::Gesture: | - | ||||||||||||||||||||||||
1155 | QGuiApplicationPrivate::processGestureEvent( | - | ||||||||||||||||||||||||
1156 | static_cast<QWindowSystemInterfacePrivate::GestureEvent *>(e)); | - | ||||||||||||||||||||||||
1157 | break; | - | ||||||||||||||||||||||||
1158 | - | |||||||||||||||||||||||||
1159 | case QWindowSystemInterfacePrivate::PlatformPanel: | - | ||||||||||||||||||||||||
1160 | QGuiApplicationPrivate::processPlatformPanelEvent( | - | ||||||||||||||||||||||||
1161 | static_cast<QWindowSystemInterfacePrivate::PlatformPanelEvent *>(e)); | - | ||||||||||||||||||||||||
1162 | break; | - | ||||||||||||||||||||||||
1163 | case QWindowSystemInterfacePrivate::FileOpen: | - | ||||||||||||||||||||||||
1164 | QGuiApplicationPrivate::processFileOpenEvent( | - | ||||||||||||||||||||||||
1165 | static_cast<QWindowSystemInterfacePrivate::FileOpenEvent *>(e)); | - | ||||||||||||||||||||||||
1166 | break; | - | ||||||||||||||||||||||||
1167 | - | |||||||||||||||||||||||||
1168 | case QWindowSystemInterfacePrivate::ContextMenu: | - | ||||||||||||||||||||||||
1169 | QGuiApplicationPrivate::processContextMenuEvent( | - | ||||||||||||||||||||||||
1170 | static_cast<QWindowSystemInterfacePrivate::ContextMenuEvent *>(e)); | - | ||||||||||||||||||||||||
1171 | break; | - | ||||||||||||||||||||||||
1172 | - | |||||||||||||||||||||||||
1173 | case QWindowSystemInterfacePrivate::EnterWhatsThisMode: | - | ||||||||||||||||||||||||
1174 | QGuiApplication::postEvent(QGuiApplication::instance(), new QEvent(QEvent::EnterWhatsThisMode)); | - | ||||||||||||||||||||||||
1175 | break; | - | ||||||||||||||||||||||||
1176 | default: | - | ||||||||||||||||||||||||
1177 | QMessageLogger(__FILE__, 17711797, __PRETTY_FUNCTION__).warning() << "Unknown user input event type:" << e->type; | - | ||||||||||||||||||||||||
1178 | break; | - | ||||||||||||||||||||||||
1179 | } | - | ||||||||||||||||||||||||
1180 | } | - | ||||||||||||||||||||||||
1181 | - | |||||||||||||||||||||||||
1182 | void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e) | - | ||||||||||||||||||||||||
1183 | { | - | ||||||||||||||||||||||||
1184 | QEvent::Type type; | - | ||||||||||||||||||||||||
1185 | Qt::MouseButtons stateChange = e->buttons ^ buttons; | - | ||||||||||||||||||||||||
1186 | if (e->globalPos != QGuiApplicationPrivate::lastCursorPosition
| 0 | ||||||||||||||||||||||||
1187 | - | |||||||||||||||||||||||||
1188 | - | |||||||||||||||||||||||||
1189 | - | |||||||||||||||||||||||||
1190 | QWindowSystemInterfacePrivate::MouseEvent mouseButtonEvent( | - | ||||||||||||||||||||||||
1191 | e->window.data(), e->timestamp, e->type, e->localPos, e->globalPos, e->buttons, e->modifiers, e->source); | - | ||||||||||||||||||||||||
1192 | if (e->flags & QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic
| 0 | ||||||||||||||||||||||||
1193 | mouseButtonEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic; never executed: mouseButtonEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic; | 0 | ||||||||||||||||||||||||
1194 | e->buttons = buttons; | - | ||||||||||||||||||||||||
1195 | processMouseEvent(e); | - | ||||||||||||||||||||||||
1196 | processMouseEvent(&mouseButtonEvent); | - | ||||||||||||||||||||||||
1197 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1198 | } | - | ||||||||||||||||||||||||
1199 | - | |||||||||||||||||||||||||
1200 | QWindow *window = e->window.data(); | - | ||||||||||||||||||||||||
1201 | modifier_buttons = e->modifiers; | - | ||||||||||||||||||||||||
1202 | - | |||||||||||||||||||||||||
1203 | QPointF localPoint = e->localPos; | - | ||||||||||||||||||||||||
1204 | QPointF globalPoint = e->globalPos; | - | ||||||||||||||||||||||||
1205 | - | |||||||||||||||||||||||||
1206 | if (e->nullWindow()
| 0 | ||||||||||||||||||||||||
1207 | window = QGuiApplication::topLevelAt(globalPoint.toPoint()); | - | ||||||||||||||||||||||||
1208 | if (window
| 0 | ||||||||||||||||||||||||
1209 | - | |||||||||||||||||||||||||
1210 | - | |||||||||||||||||||||||||
1211 | if (e->buttons != Qt::NoButton
| 0 | ||||||||||||||||||||||||
1212 | if (!currentMousePressWindow
| 0 | ||||||||||||||||||||||||
1213 | currentMousePressWindow = window; never executed: currentMousePressWindow = window; | 0 | ||||||||||||||||||||||||
1214 | else | - | ||||||||||||||||||||||||
1215 | window = currentMousePressWindow; never executed: window = currentMousePressWindow; | 0 | ||||||||||||||||||||||||
1216 | } else if (currentMousePressWindow
| 0 | ||||||||||||||||||||||||
1217 | window = currentMousePressWindow; | - | ||||||||||||||||||||||||
1218 | currentMousePressWindow = 0; | - | ||||||||||||||||||||||||
1219 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1220 | QPointF delta = globalPoint - globalPoint.toPoint(); | - | ||||||||||||||||||||||||
1221 | localPoint = window->mapFromGlobal(globalPoint.toPoint()) + delta; | - | ||||||||||||||||||||||||
1222 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1223 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1224 | - | |||||||||||||||||||||||||
1225 | Qt::MouseButton button = Qt::NoButton; | - | ||||||||||||||||||||||||
1226 | bool doubleClick = false; | - | ||||||||||||||||||||||||
1227 | const bool frameStrut = e->type == QWindowSystemInterfacePrivate::FrameStrutMouse; | - | ||||||||||||||||||||||||
1228 | - | |||||||||||||||||||||||||
1229 | if (QGuiApplicationPrivate::lastCursorPosition != globalPoint
| 0 | ||||||||||||||||||||||||
1230 | type = frameStrut
| 0 | ||||||||||||||||||||||||
1231 | QGuiApplicationPrivate::lastCursorPosition = globalPoint; | - | ||||||||||||||||||||||||
1232 | if (qAbs(globalPoint.x() - mousePressX) > mouse_double_click_distance
| 0 | ||||||||||||||||||||||||
1233 | qAbs(globalPoint.y() - mousePressY) > mouse_double_click_distance
| 0 | ||||||||||||||||||||||||
1234 | mousePressButton = Qt::NoButton; never executed: mousePressButton = Qt::NoButton; | 0 | ||||||||||||||||||||||||
1235 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1236 | for (int check = Qt::LeftButton; | - | ||||||||||||||||||||||||
1237 | check <= int(Qt::MaxMouseButton)
| 0 | ||||||||||||||||||||||||
1238 | check = check << 1) { | - | ||||||||||||||||||||||||
1239 | if (check & stateChange
| 0 | ||||||||||||||||||||||||
1240 | button = Qt::MouseButton(check); | - | ||||||||||||||||||||||||
1241 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1242 | } | - | ||||||||||||||||||||||||
1243 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1244 | if (button == Qt::NoButton
| 0 | ||||||||||||||||||||||||
1245 | - | |||||||||||||||||||||||||
1246 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1247 | } | - | ||||||||||||||||||||||||
1248 | mouse_buttons = buttons = e->buttons; | - | ||||||||||||||||||||||||
1249 | if (button & e->buttons
| 0 | ||||||||||||||||||||||||
1250 | ulong doubleClickInterval = static_cast<ulong>(QGuiApplication::styleHints()->mouseDoubleClickInterval()); | - | ||||||||||||||||||||||||
1251 | doubleClick = e->timestamp - mousePressTime < doubleClickInterval
| 0 | ||||||||||||||||||||||||
1252 | type = frameStrut
| 0 | ||||||||||||||||||||||||
1253 | mousePressTime = e->timestamp; | - | ||||||||||||||||||||||||
1254 | mousePressButton = button; | - | ||||||||||||||||||||||||
1255 | const QPoint point = QGuiApplicationPrivate::lastCursorPosition.toPoint(); | - | ||||||||||||||||||||||||
1256 | mousePressX = point.x(); | - | ||||||||||||||||||||||||
1257 | mousePressY = point.y(); | - | ||||||||||||||||||||||||
1258 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1259 | type = frameStrut
| 0 | ||||||||||||||||||||||||
1260 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1261 | } | - | ||||||||||||||||||||||||
1262 | - | |||||||||||||||||||||||||
1263 | if (!window
| 0 | ||||||||||||||||||||||||
1264 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1265 | - | |||||||||||||||||||||||||
1266 | - | |||||||||||||||||||||||||
1267 | if (!e->synthetic()
| 0 | ||||||||||||||||||||||||
1268 | if (const
| 0 | ||||||||||||||||||||||||
1269 | if (QPlatformCursor *cursor = screen->handle()->cursor()
| 0 | ||||||||||||||||||||||||
1270 | const QPointF nativeLocalPoint = QHighDpi::toNativePixels(localPoint, screen); | - | ||||||||||||||||||||||||
1271 | const QPointF nativeGlobalPoint = QHighDpi::toNativePixels(globalPoint, screen); | - | ||||||||||||||||||||||||
1272 | QMouseEvent ev(type, nativeLocalPoint, nativeLocalPoint, nativeGlobalPoint, | - | ||||||||||||||||||||||||
1273 | button, buttons, e->modifiers, e->source); | - | ||||||||||||||||||||||||
1274 | ev.setTimestamp(e->timestamp); | - | ||||||||||||||||||||||||
1275 | cursor->pointerEvent(ev); | - | ||||||||||||||||||||||||
1276 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1277 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1278 | - | |||||||||||||||||||||||||
1279 | - | |||||||||||||||||||||||||
1280 | QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, buttons, e->modifiers, e->source); | - | ||||||||||||||||||||||||
1281 | ev.setTimestamp(e->timestamp); | - | ||||||||||||||||||||||||
1282 | - | |||||||||||||||||||||||||
1283 | if (window->d_func()->blockedByModalWindow&& !(static_cast<QGuiApplication *>(QCoreApplication::instance()))->d_func()->popupActive())
| 0 | ||||||||||||||||||||||||
1284 | - | |||||||||||||||||||||||||
1285 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1286 | } | - | ||||||||||||||||||||||||
1287 | - | |||||||||||||||||||||||||
1288 | if (doubleClick
| 0 | ||||||||||||||||||||||||
1289 | - | |||||||||||||||||||||||||
1290 | setMouseEventFlags(&ev, ev.flags() | Qt::MouseEventCreatedDoubleClick); | - | ||||||||||||||||||||||||
1291 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1292 | - | |||||||||||||||||||||||||
1293 | QGuiApplication::sendSpontaneousEvent(window, &ev); | - | ||||||||||||||||||||||||
1294 | e->eventAccepted = ev.isAccepted(); | - | ||||||||||||||||||||||||
1295 | if (!e->synthetic()
| 0 | ||||||||||||||||||||||||
1296 | && !frameStrut
| 0 | ||||||||||||||||||||||||
1297 | && (static_cast<
| 0 | ||||||||||||||||||||||||
1298 | if (!m_fakeTouchDevice
| 0 | ||||||||||||||||||||||||
1299 | m_fakeTouchDevice = new QTouchDevice; | - | ||||||||||||||||||||||||
1300 | QWindowSystemInterface::registerTouchDevice(m_fakeTouchDevice); | - | ||||||||||||||||||||||||
1301 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1302 | QList<QWindowSystemInterface::TouchPoint> points; | - | ||||||||||||||||||||||||
1303 | QWindowSystemInterface::TouchPoint point; | - | ||||||||||||||||||||||||
1304 | point.id = 1; | - | ||||||||||||||||||||||||
1305 | point.area = QRectF(globalPoint.x() - 2, globalPoint.y() - 2, 4, 4); | - | ||||||||||||||||||||||||
1306 | - | |||||||||||||||||||||||||
1307 | - | |||||||||||||||||||||||||
1308 | - | |||||||||||||||||||||||||
1309 | - | |||||||||||||||||||||||||
1310 | if (type == QEvent::MouseButtonPress
| 0 | ||||||||||||||||||||||||
1311 | point.state = Qt::TouchPointPressed; | - | ||||||||||||||||||||||||
1312 | } never executed: else if (type == QEvent::MouseButtonReleaseend of block
| 0 | ||||||||||||||||||||||||
1313 | point.state = Qt::TouchPointReleased; | - | ||||||||||||||||||||||||
1314 | } never executed: else if (type == QEvent::MouseMoveend of block
| 0 | ||||||||||||||||||||||||
1315 | point.state = Qt::TouchPointMoved; | - | ||||||||||||||||||||||||
1316 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1317 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1318 | } | - | ||||||||||||||||||||||||
1319 | - | |||||||||||||||||||||||||
1320 | points << point; | - | ||||||||||||||||||||||||
1321 | - | |||||||||||||||||||||||||
1322 | QEvent::Type type; | - | ||||||||||||||||||||||||
1323 | QList<QTouchEvent::TouchPoint> touchPoints = QWindowSystemInterfacePrivate::fromNativeTouchPoints(points, window, &type); | - | ||||||||||||||||||||||||
1324 | - | |||||||||||||||||||||||||
1325 | QWindowSystemInterfacePrivate::TouchEvent fake(window, e->timestamp, type, m_fakeTouchDevice, touchPoints, e->modifiers); | - | ||||||||||||||||||||||||
1326 | fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic; | - | ||||||||||||||||||||||||
1327 | processTouchEvent(&fake); | - | ||||||||||||||||||||||||
1328 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1329 | if (doubleClick
| 0 | ||||||||||||||||||||||||
1330 | mousePressButton = Qt::NoButton; | - | ||||||||||||||||||||||||
1331 | if (!e->window.isNull()
| 0 | ||||||||||||||||||||||||
1332 | const QEvent::Type doubleClickType = frameStrut
| 0 | ||||||||||||||||||||||||
1333 | QMouseEvent dblClickEvent(doubleClickType, localPoint, localPoint, globalPoint, | - | ||||||||||||||||||||||||
1334 | button, buttons, e->modifiers, e->source); | - | ||||||||||||||||||||||||
1335 | dblClickEvent.setTimestamp(e->timestamp); | - | ||||||||||||||||||||||||
1336 | QGuiApplication::sendSpontaneousEvent(window, &dblClickEvent); | - | ||||||||||||||||||||||||
1337 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1338 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1339 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1340 | - | |||||||||||||||||||||||||
1341 | void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e) | - | ||||||||||||||||||||||||
1342 | { | - | ||||||||||||||||||||||||
1343 | - | |||||||||||||||||||||||||
1344 | QWindow *window = e->window.data(); | - | ||||||||||||||||||||||||
1345 | QPointF globalPoint = e->globalPos; | - | ||||||||||||||||||||||||
1346 | QPointF localPoint = e->localPos; | - | ||||||||||||||||||||||||
1347 | - | |||||||||||||||||||||||||
1348 | if (e->nullWindow()
| 0 | ||||||||||||||||||||||||
1349 | window = QGuiApplication::topLevelAt(globalPoint.toPoint()); | - | ||||||||||||||||||||||||
1350 | if (window
| 0 | ||||||||||||||||||||||||
1351 | QPointF delta = globalPoint - globalPoint.toPoint(); | - | ||||||||||||||||||||||||
1352 | localPoint = window->mapFromGlobal(globalPoint.toPoint()) + delta; | - | ||||||||||||||||||||||||
1353 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1354 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1355 | - | |||||||||||||||||||||||||
1356 | if (!window
| 0 | ||||||||||||||||||||||||
1357 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1358 | - | |||||||||||||||||||||||||
1359 | QGuiApplicationPrivate::lastCursorPosition = globalPoint; | - | ||||||||||||||||||||||||
1360 | modifier_buttons = e->modifiers; | - | ||||||||||||||||||||||||
1361 | - | |||||||||||||||||||||||||
1362 | if (window->d_func()->blockedByModalWindow
| 0 | ||||||||||||||||||||||||
1363 | - | |||||||||||||||||||||||||
1364 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1365 | } | - | ||||||||||||||||||||||||
1366 | - | |||||||||||||||||||||||||
1367 | QWheelEvent ev(localPoint, globalPoint, e->pixelDelta, e->angleDelta, e->qt4Delta, e->qt4Orientation, | - | ||||||||||||||||||||||||
1368 | buttons, e->modifiers, e->phase, e->source, e->inverted); | - | ||||||||||||||||||||||||
1369 | ev.setTimestamp(e->timestamp); | - | ||||||||||||||||||||||||
1370 | QGuiApplication::sendSpontaneousEvent(window, &ev); | - | ||||||||||||||||||||||||
1371 | - | |||||||||||||||||||||||||
1372 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1373 | - | |||||||||||||||||||||||||
1374 | - | |||||||||||||||||||||||||
1375 | - | |||||||||||||||||||||||||
1376 | void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e) | - | ||||||||||||||||||||||||
1377 | { | - | ||||||||||||||||||||||||
1378 | QWindow *window = e->window.data(); | - | ||||||||||||||||||||||||
1379 | modifier_buttons = e->modifiers; | - | ||||||||||||||||||||||||
1380 | if (e->nullWindow()
| 0 | ||||||||||||||||||||||||
1381 | - | |||||||||||||||||||||||||
1382 | - | |||||||||||||||||||||||||
1383 | - | |||||||||||||||||||||||||
1384 | ) { | - | ||||||||||||||||||||||||
1385 | window = QGuiApplication::focusWindow(); | - | ||||||||||||||||||||||||
1386 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1387 | - | |||||||||||||||||||||||||
1388 | - | |||||||||||||||||||||||||
1389 | - | |||||||||||||||||||||||||
1390 | - | |||||||||||||||||||||||||
1391 | if (e->keyType == QEvent::KeyPress
| 0 | ||||||||||||||||||||||||
1392 | if (QWindowSystemInterface::handleShortcutEvent(window, e->timestamp, e->key, e->modifiers,
| 0 | ||||||||||||||||||||||||
1393 | e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers, e->unicode, e->repeat, e->repeatCount)
| 0 | ||||||||||||||||||||||||
1394 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1395 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1396 | - | |||||||||||||||||||||||||
1397 | - | |||||||||||||||||||||||||
1398 | QKeyEvent ev(e->keyType, e->key, e->modifiers, | - | ||||||||||||||||||||||||
1399 | e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers, | - | ||||||||||||||||||||||||
1400 | e->unicode, e->repeat, e->repeatCount); | - | ||||||||||||||||||||||||
1401 | ev.setTimestamp(e->timestamp); | - | ||||||||||||||||||||||||
1402 | - | |||||||||||||||||||||||||
1403 | - | |||||||||||||||||||||||||
1404 | - | |||||||||||||||||||||||||
1405 | if (window
| 0 | ||||||||||||||||||||||||
1406 | QGuiApplication::sendSpontaneousEvent(window, &ev); never executed: QGuiApplication::sendSpontaneousEvent(window, &ev); | 0 | ||||||||||||||||||||||||
1407 | e->eventAccepted = ev.isAccepted(); | - | ||||||||||||||||||||||||
1408 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1409 | - | |||||||||||||||||||||||||
1410 | void QGuiApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e) | - | ||||||||||||||||||||||||
1411 | { | - | ||||||||||||||||||||||||
1412 | if (!e->enter) | - | ||||||||||||||||||||||||
1413 | return; | - | ||||||||||||||||||||||||
1414 | if (e->enter.data()->d_func()->blockedByModalWindow) { | - | ||||||||||||||||||||||||
1415 | - | |||||||||||||||||||||||||
1416 | return; | - | ||||||||||||||||||||||||
1417 | } | - | ||||||||||||||||||||||||
1418 | - | |||||||||||||||||||||||||
1419 | currentMouseWindow = e->enter; | - | ||||||||||||||||||||||||
1420 | - | |||||||||||||||||||||||||
1421 | QEnterEvent event(e->localPos, e->localPos, e->globalPos); | - | ||||||||||||||||||||||||
1422 | QCoreApplication::sendSpontaneousEvent(e->enter.data(), &event); | - | ||||||||||||||||||||||||
1423 | } | - | ||||||||||||||||||||||||
1424 | - | |||||||||||||||||||||||||
1425 | void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e) | - | ||||||||||||||||||||||||
1426 | { | - | ||||||||||||||||||||||||
1427 | if (!e->leave) | - | ||||||||||||||||||||||||
1428 | return; | - | ||||||||||||||||||||||||
1429 | if (e->leave.data()->d_func()->blockedByModalWindow) { | - | ||||||||||||||||||||||||
1430 | - | |||||||||||||||||||||||||
1431 | return; | - | ||||||||||||||||||||||||
1432 | } | - | ||||||||||||||||||||||||
1433 | - | |||||||||||||||||||||||||
1434 | currentMouseWindow = 0; | - | ||||||||||||||||||||||||
1435 | - | |||||||||||||||||||||||||
1436 | QEvent event(QEvent::Leave); | - | ||||||||||||||||||||||||
1437 | QCoreApplication::sendSpontaneousEvent(e->leave.data(), &event); | - | ||||||||||||||||||||||||
1438 | } | - | ||||||||||||||||||||||||
1439 | - | |||||||||||||||||||||||||
1440 | void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e) | - | ||||||||||||||||||||||||
1441 | { | - | ||||||||||||||||||||||||
1442 | QWindow *previous = QGuiApplicationPrivate::focus_window; | - | ||||||||||||||||||||||||
1443 | QWindow *newFocus = e->activated.data(); | - | ||||||||||||||||||||||||
1444 | - | |||||||||||||||||||||||||
1445 | if (previous == newFocus) | - | ||||||||||||||||||||||||
1446 | return; | - | ||||||||||||||||||||||||
1447 | - | |||||||||||||||||||||||||
1448 | if (newFocus) | - | ||||||||||||||||||||||||
1449 | if (QPlatformWindow *platformWindow = newFocus->handle()) | - | ||||||||||||||||||||||||
1450 | if (platformWindow->isAlertState()) | - | ||||||||||||||||||||||||
1451 | platformWindow->setAlertState(false); | - | ||||||||||||||||||||||||
1452 | - | |||||||||||||||||||||||||
1453 | QObject *previousFocusObject = previous ? previous->focusObject() : 0; | - | ||||||||||||||||||||||||
1454 | - | |||||||||||||||||||||||||
1455 | if (previous) { | - | ||||||||||||||||||||||||
1456 | QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange); | - | ||||||||||||||||||||||||
1457 | QCoreApplication::sendSpontaneousEvent(previous, &focusAboutToChange); | - | ||||||||||||||||||||||||
1458 | } | - | ||||||||||||||||||||||||
1459 | - | |||||||||||||||||||||||||
1460 | QGuiApplicationPrivate::focus_window = newFocus; | - | ||||||||||||||||||||||||
1461 | if (!(static_cast<QGuiApplication *>(QCoreApplication::instance()))) | - | ||||||||||||||||||||||||
1462 | return; | - | ||||||||||||||||||||||||
1463 | - | |||||||||||||||||||||||||
1464 | if (previous) { | - | ||||||||||||||||||||||||
1465 | Qt::FocusReason r = e->reason; | - | ||||||||||||||||||||||||
1466 | if ((r == Qt::OtherFocusReason || r == Qt::ActiveWindowFocusReason) && | - | ||||||||||||||||||||||||
1467 | newFocus && (newFocus->flags() & Qt::Popup) == Qt::Popup) | - | ||||||||||||||||||||||||
1468 | r = Qt::PopupFocusReason; | - | ||||||||||||||||||||||||
1469 | QFocusEvent focusOut(QEvent::FocusOut, r); | - | ||||||||||||||||||||||||
1470 | QCoreApplication::sendSpontaneousEvent(previous, &focusOut); | - | ||||||||||||||||||||||||
1471 | QObject::disconnect(previous, qFlagLocation("2""focusObjectChanged(QObject*)" "\0" __FILE__ ":" "2082""2109"), | - | ||||||||||||||||||||||||
1472 | (static_cast<QGuiApplication *>(QCoreApplication::instance())), qFlagLocation("1""_q_updateFocusObject(QObject*)" "\0" __FILE__ ":" "2083""2110")); | - | ||||||||||||||||||||||||
1473 | } else if (!platformIntegration()->hasCapability(QPlatformIntegration::ApplicationState)) { | - | ||||||||||||||||||||||||
1474 | setApplicationState(Qt::ApplicationActive); | - | ||||||||||||||||||||||||
1475 | } | - | ||||||||||||||||||||||||
1476 | - | |||||||||||||||||||||||||
1477 | if (QGuiApplicationPrivate::focus_window) { | - | ||||||||||||||||||||||||
1478 | Qt::FocusReason r = e->reason; | - | ||||||||||||||||||||||||
1479 | if ((r == Qt::OtherFocusReason || r == Qt::ActiveWindowFocusReason) && | - | ||||||||||||||||||||||||
1480 | previous && (previous->flags() & Qt::Popup) == Qt::Popup) | - | ||||||||||||||||||||||||
1481 | r = Qt::PopupFocusReason; | - | ||||||||||||||||||||||||
1482 | QFocusEvent focusIn(QEvent::FocusIn, r); | - | ||||||||||||||||||||||||
1483 | QCoreApplication::sendSpontaneousEvent(QGuiApplicationPrivate::focus_window, &focusIn); | - | ||||||||||||||||||||||||
1484 | QObject::connect(QGuiApplicationPrivate::focus_window, qFlagLocation("2""focusObjectChanged(QObject*)" "\0" __FILE__ ":" "2095""2122"), | - | ||||||||||||||||||||||||
1485 | (static_cast<QGuiApplication *>(QCoreApplication::instance())), qFlagLocation("1""_q_updateFocusObject(QObject*)" "\0" __FILE__ ":" "2096""2123")); | - | ||||||||||||||||||||||||
1486 | } else if (!platformIntegration()->hasCapability(QPlatformIntegration::ApplicationState)) { | - | ||||||||||||||||||||||||
1487 | setApplicationState(Qt::ApplicationInactive); | - | ||||||||||||||||||||||||
1488 | } | - | ||||||||||||||||||||||||
1489 | - | |||||||||||||||||||||||||
1490 | if (self) { | - | ||||||||||||||||||||||||
1491 | self->notifyActiveWindowChange(previous); | - | ||||||||||||||||||||||||
1492 | - | |||||||||||||||||||||||||
1493 | if (previousFocusObject != (static_cast<QGuiApplication *>(QCoreApplication::instance()))->focusObject()) | - | ||||||||||||||||||||||||
1494 | self->_q_updateFocusObject((static_cast<QGuiApplication *>(QCoreApplication::instance()))->focusObject()); | - | ||||||||||||||||||||||||
1495 | } | - | ||||||||||||||||||||||||
1496 | - | |||||||||||||||||||||||||
1497 | (static_cast<QGuiApplication *>(QCoreApplication::instance()))->focusWindowChanged(newFocus); | - | ||||||||||||||||||||||||
1498 | if (previous) | - | ||||||||||||||||||||||||
1499 | previous->activeChanged(); | - | ||||||||||||||||||||||||
1500 | if (newFocus) | - | ||||||||||||||||||||||||
1501 | newFocus->activeChanged(); | - | ||||||||||||||||||||||||
1502 | } | - | ||||||||||||||||||||||||
1503 | - | |||||||||||||||||||||||||
1504 | void QGuiApplicationPrivate::processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *wse) | - | ||||||||||||||||||||||||
1505 | { | - | ||||||||||||||||||||||||
1506 | if (QWindow *window = wse->window.data()) { | - | ||||||||||||||||||||||||
1507 | QWindowStateChangeEvent e(window->windowState()); | - | ||||||||||||||||||||||||
1508 | window->d_func()->windowState = wse->newState; | - | ||||||||||||||||||||||||
1509 | QGuiApplication::sendSpontaneousEvent(window, &e); | - | ||||||||||||||||||||||||
1510 | } | - | ||||||||||||||||||||||||
1511 | } | - | ||||||||||||||||||||||||
1512 | - | |||||||||||||||||||||||||
1513 | void QGuiApplicationPrivate::processWindowScreenChangedEvent(QWindowSystemInterfacePrivate::WindowScreenChangedEvent *wse) | - | ||||||||||||||||||||||||
1514 | { | - | ||||||||||||||||||||||||
1515 | if (QWindow *window = wse->window.data()) { | - | ||||||||||||||||||||||||
1516 | if (window->isTopLevel()) { | - | ||||||||||||||||||||||||
1517 | if (QScreen *screen = wse->screen.data()) | - | ||||||||||||||||||||||||
1518 | window->d_func()->setTopLevelScreen(screen, false ); | - | ||||||||||||||||||||||||
1519 | else | - | ||||||||||||||||||||||||
1520 | window->setScreen(0); | - | ||||||||||||||||||||||||
1521 | } | - | ||||||||||||||||||||||||
1522 | - | |||||||||||||||||||||||||
1523 | if (window->handle()) { | - | ||||||||||||||||||||||||
1524 | QWindowSystemInterfacePrivate::GeometryChangeEvent gce(window, QHighDpi::fromNativePixels(window->handle()->geometry(), window), QRect()); | - | ||||||||||||||||||||||||
1525 | processGeometryChangeEvent(&gce); | - | ||||||||||||||||||||||||
1526 | } | - | ||||||||||||||||||||||||
1527 | } | - | ||||||||||||||||||||||||
1528 | } | - | ||||||||||||||||||||||||
1529 | - | |||||||||||||||||||||||||
1530 | void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce) | - | ||||||||||||||||||||||||
1531 | { | - | ||||||||||||||||||||||||
1532 | if (self) | - | ||||||||||||||||||||||||
1533 | self->notifyThemeChanged(); | - | ||||||||||||||||||||||||
1534 | if (QWindow *window = tce->window.data()) { | - | ||||||||||||||||||||||||
1535 | QEvent e(QEvent::ThemeChange); | - | ||||||||||||||||||||||||
1536 | QGuiApplication::sendSpontaneousEvent(window, &e); | - | ||||||||||||||||||||||||
1537 | } | - | ||||||||||||||||||||||||
1538 | } | - | ||||||||||||||||||||||||
1539 | - | |||||||||||||||||||||||||
1540 | void QGuiApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e) | - | ||||||||||||||||||||||||
1541 | { | - | ||||||||||||||||||||||||
1542 | if (e->tlw.isNull()) | - | ||||||||||||||||||||||||
1543 | return; | - | ||||||||||||||||||||||||
1544 | - | |||||||||||||||||||||||||
1545 | QWindow *window = e->tlw.data(); | - | ||||||||||||||||||||||||
1546 | if (!window) | - | ||||||||||||||||||||||||
1547 | return; | - | ||||||||||||||||||||||||
1548 | - | |||||||||||||||||||||||||
1549 | QRect newRect = e->newGeometry; | - | ||||||||||||||||||||||||
1550 | QRect oldRect = e->oldGeometry.isNull() ? window->d_func()->geometry : e->oldGeometry; | - | ||||||||||||||||||||||||
1551 | - | |||||||||||||||||||||||||
1552 | bool isResize = oldRect.size() != newRect.size(); | - | ||||||||||||||||||||||||
1553 | bool isMove = oldRect.topLeft() != newRect.topLeft(); | - | ||||||||||||||||||||||||
1554 | - | |||||||||||||||||||||||||
1555 | window->d_func()->geometry = newRect; | - | ||||||||||||||||||||||||
1556 | - | |||||||||||||||||||||||||
1557 | if (isResize || window->d_func()->resizeEventPending) { | - | ||||||||||||||||||||||||
1558 | QResizeEvent e(newRect.size(), oldRect.size()); | - | ||||||||||||||||||||||||
1559 | QGuiApplication::sendSpontaneousEvent(window, &e); | - | ||||||||||||||||||||||||
1560 | - | |||||||||||||||||||||||||
1561 | window->d_func()->resizeEventPending = false; | - | ||||||||||||||||||||||||
1562 | - | |||||||||||||||||||||||||
1563 | if (oldRect.width() != newRect.width()) | - | ||||||||||||||||||||||||
1564 | window->widthChanged(newRect.width()); | - | ||||||||||||||||||||||||
1565 | if (oldRect.height() != newRect.height()) | - | ||||||||||||||||||||||||
1566 | window->heightChanged(newRect.height()); | - | ||||||||||||||||||||||||
1567 | } | - | ||||||||||||||||||||||||
1568 | - | |||||||||||||||||||||||||
1569 | if (isMove) { | - | ||||||||||||||||||||||||
1570 | - | |||||||||||||||||||||||||
1571 | QMoveEvent e(newRect.topLeft(), oldRect.topLeft()); | - | ||||||||||||||||||||||||
1572 | QGuiApplication::sendSpontaneousEvent(window, &e); | - | ||||||||||||||||||||||||
1573 | - | |||||||||||||||||||||||||
1574 | if (oldRect.x() != newRect.x()) | - | ||||||||||||||||||||||||
1575 | window->xChanged(newRect.x()); | - | ||||||||||||||||||||||||
1576 | if (oldRect.y() != newRect.y()) | - | ||||||||||||||||||||||||
1577 | window->yChanged(newRect.y()); | - | ||||||||||||||||||||||||
1578 | } | - | ||||||||||||||||||||||||
1579 | } | - | ||||||||||||||||||||||||
1580 | - | |||||||||||||||||||||||||
1581 | void QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e) | - | ||||||||||||||||||||||||
1582 | { | - | ||||||||||||||||||||||||
1583 | if (e->window.isNull()) | - | ||||||||||||||||||||||||
1584 | return; | - | ||||||||||||||||||||||||
1585 | if (e->window.data()->d_func()->blockedByModalWindow) { | - | ||||||||||||||||||||||||
1586 | - | |||||||||||||||||||||||||
1587 | return; | - | ||||||||||||||||||||||||
1588 | } | - | ||||||||||||||||||||||||
1589 | - | |||||||||||||||||||||||||
1590 | QCloseEvent event; | - | ||||||||||||||||||||||||
1591 | QGuiApplication::sendSpontaneousEvent(e->window.data(), &event); | - | ||||||||||||||||||||||||
1592 | if (e->accepted) { | - | ||||||||||||||||||||||||
1593 | *(e->accepted) = event.isAccepted(); | - | ||||||||||||||||||||||||
1594 | } | - | ||||||||||||||||||||||||
1595 | } | - | ||||||||||||||||||||||||
1596 | - | |||||||||||||||||||||||||
1597 | void QGuiApplicationPrivate::processFileOpenEvent(QWindowSystemInterfacePrivate::FileOpenEvent *e) | - | ||||||||||||||||||||||||
1598 | { | - | ||||||||||||||||||||||||
1599 | if (e->url.isEmpty()) | - | ||||||||||||||||||||||||
1600 | return; | - | ||||||||||||||||||||||||
1601 | - | |||||||||||||||||||||||||
1602 | QFileOpenEvent event(e->url); | - | ||||||||||||||||||||||||
1603 | QGuiApplication::sendSpontaneousEvent((static_cast<QGuiApplication *>(QCoreApplication::instance())), &event); | - | ||||||||||||||||||||||||
1604 | } | - | ||||||||||||||||||||||||
1605 | - | |||||||||||||||||||||||||
1606 | QGuiApplicationPrivate::TabletPointData &QGuiApplicationPrivate::tabletDevicePoint(qint64 deviceId) | - | ||||||||||||||||||||||||
1607 | { | - | ||||||||||||||||||||||||
1608 | for (int i = 0; i < tabletDevicePoints.size()
| 0 | ||||||||||||||||||||||||
1609 | TabletPointData &pointData = tabletDevicePoints[i]; | - | ||||||||||||||||||||||||
1610 | if (pointData.deviceId == deviceId
| 0 | ||||||||||||||||||||||||
1611 | return never executed: pointData;return pointData; never executed: return pointData; | 0 | ||||||||||||||||||||||||
1612 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1613 | - | |||||||||||||||||||||||||
1614 | tabletDevicePoints.append(TabletPointData(deviceId)); | - | ||||||||||||||||||||||||
1615 | return never executed: tabletDevicePoints.last();return tabletDevicePoints.last(); never executed: return tabletDevicePoints.last(); | 0 | ||||||||||||||||||||||||
1616 | } | - | ||||||||||||||||||||||||
1617 | - | |||||||||||||||||||||||||
1618 | void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::TabletEvent *e) | - | ||||||||||||||||||||||||
1619 | { | - | ||||||||||||||||||||||||
1620 | - | |||||||||||||||||||||||||
1621 | TabletPointData &pointData = tabletDevicePoint(e->uid); | - | ||||||||||||||||||||||||
1622 | - | |||||||||||||||||||||||||
1623 | QEvent::Type type = QEvent::TabletMove; | - | ||||||||||||||||||||||||
1624 | if (e->buttons != tabletStatepointData.state
| 0 | ||||||||||||||||||||||||
1625 | type = (
never executed: type = (e->buttons > pointData.state) ? QEvent::TabletPress : QEvent::TabletRelease; | 0 | ||||||||||||||||||||||||
1626 | - | |||||||||||||||||||||||||
1627 | QWindow *window = e->window.data(); | - | ||||||||||||||||||||||||
1628 | modifier_buttons = e->modifiers; | - | ||||||||||||||||||||||||
1629 | - | |||||||||||||||||||||||||
1630 | bool localValid = true; | - | ||||||||||||||||||||||||
1631 | - | |||||||||||||||||||||||||
1632 | - | |||||||||||||||||||||||||
1633 | - | |||||||||||||||||||||||||
1634 | if (type == QEvent::TabletPress
| 0 | ||||||||||||||||||||||||
1635 | if (e->nullWindow()
| 0 | ||||||||||||||||||||||||
1636 | window = QGuiApplication::topLevelAt(e->global.toPoint()); | - | ||||||||||||||||||||||||
1637 | localValid = false; | - | ||||||||||||||||||||||||
1638 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1639 | if (!window
| 0 | ||||||||||||||||||||||||
1640 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1641 | tabletPressTargetpointData.target = window; | - | ||||||||||||||||||||||||
1642 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1643 | if (e->nullWindow()
| 0 | ||||||||||||||||||||||||
1644 | window = tabletPressTargetpointData.target; | - | ||||||||||||||||||||||||
1645 | localValid = false; | - | ||||||||||||||||||||||||
1646 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1647 | if (type == QEvent::TabletRelease
| 0 | ||||||||||||||||||||||||
1648 | tabletPressTargetpointData.target never executed: = 0nullptr;pointData.target = nullptr; never executed: pointData.target = nullptr; | 0 | ||||||||||||||||||||||||
1649 | if (!window
| 0 | ||||||||||||||||||||||||
1650 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1651 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1652 | QPointF local = e->local; | - | ||||||||||||||||||||||||
1653 | if (!localValid
| 0 | ||||||||||||||||||||||||
1654 | QPointF delta = e->global - e->global.toPoint(); | - | ||||||||||||||||||||||||
1655 | local = window->mapFromGlobal(e->global.toPoint()) + delta; | - | ||||||||||||||||||||||||
1656 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1657 | Qt::MouseButtons stateChange = e->buttons ^ tabletStatepointData.state; | - | ||||||||||||||||||||||||
1658 | Qt::MouseButton button = Qt::NoButton; | - | ||||||||||||||||||||||||
1659 | for (int check = Qt::LeftButton; check <= int(Qt::MaxMouseButton)
| 0 | ||||||||||||||||||||||||
1660 | if (check & stateChange
| 0 | ||||||||||||||||||||||||
1661 | button = Qt::MouseButton(check); | - | ||||||||||||||||||||||||
1662 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1663 | } | - | ||||||||||||||||||||||||
1664 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1665 | QTabletEvent ev(type, local, e->global, | - | ||||||||||||||||||||||||
1666 | e->device, e->pointerType, e->pressure, e->xTilt, e->yTilt, | - | ||||||||||||||||||||||||
1667 | e->tangentialPressure, e->rotation, e->z, | - | ||||||||||||||||||||||||
1668 | e->modifiers, e->uid, button, e->buttons); | - | ||||||||||||||||||||||||
1669 | ev.setAccepted(false); | - | ||||||||||||||||||||||||
1670 | ev.setTimestamp(e->timestamp); | - | ||||||||||||||||||||||||
1671 | QGuiApplication::sendSpontaneousEvent(window, &ev); | - | ||||||||||||||||||||||||
1672 | tabletStatepointData.state = e->buttons; | - | ||||||||||||||||||||||||
1673 | if (!ev.isAccepted()
| 0 | ||||||||||||||||||||||||
1674 | && (static_cast<
| 0 | ||||||||||||||||||||||||
1675 | QWindowSystemInterfacePrivate::MouseEvent fake(window, e->timestamp, e->local, e->global, | - | ||||||||||||||||||||||||
1676 | e->buttons, e->modifiers, Qt::MouseEventSynthesizedByQt); | - | ||||||||||||||||||||||||
1677 | fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic; | - | ||||||||||||||||||||||||
1678 | processMouseEvent(&fake); | - | ||||||||||||||||||||||||
1679 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1680 | - | |||||||||||||||||||||||||
1681 | - | |||||||||||||||||||||||||
1682 | - | |||||||||||||||||||||||||
1683 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1684 | - | |||||||||||||||||||||||||
1685 | void QGuiApplicationPrivate::processTabletEnterProximityEvent(QWindowSystemInterfacePrivate::TabletEnterProximityEvent *e) | - | ||||||||||||||||||||||||
1686 | { | - | ||||||||||||||||||||||||
1687 | - | |||||||||||||||||||||||||
1688 | QTabletEvent ev(QEvent::TabletEnterProximity, QPointF(), QPointF(), | - | ||||||||||||||||||||||||
1689 | e->device, e->pointerType, 0, 0, 0, | - | ||||||||||||||||||||||||
1690 | 0, 0, 0, | - | ||||||||||||||||||||||||
1691 | Qt::NoModifier, e->uid, Qt::NoButton, tabletStatetabletDevicePoint(e->uid).state); | - | ||||||||||||||||||||||||
1692 | ev.setTimestamp(e->timestamp); | - | ||||||||||||||||||||||||
1693 | QGuiApplication::sendSpontaneousEvent((static_cast<QGuiApplication *>(QCoreApplication::instance())), &ev); | - | ||||||||||||||||||||||||
1694 | - | |||||||||||||||||||||||||
1695 | - | |||||||||||||||||||||||||
1696 | - | |||||||||||||||||||||||||
1697 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1698 | - | |||||||||||||||||||||||||
1699 | void QGuiApplicationPrivate::processTabletLeaveProximityEvent(QWindowSystemInterfacePrivate::TabletLeaveProximityEvent *e) | - | ||||||||||||||||||||||||
1700 | { | - | ||||||||||||||||||||||||
1701 | - | |||||||||||||||||||||||||
1702 | QTabletEvent ev(QEvent::TabletLeaveProximity, QPointF(), QPointF(), | - | ||||||||||||||||||||||||
1703 | e->device, e->pointerType, 0, 0, 0, | - | ||||||||||||||||||||||||
1704 | 0, 0, 0, | - | ||||||||||||||||||||||||
1705 | Qt::NoModifier, e->uid, Qt::NoButton, tabletStatetabletDevicePoint(e->uid).state); | - | ||||||||||||||||||||||||
1706 | ev.setTimestamp(e->timestamp); | - | ||||||||||||||||||||||||
1707 | QGuiApplication::sendSpontaneousEvent((static_cast<QGuiApplication *>(QCoreApplication::instance())), &ev); | - | ||||||||||||||||||||||||
1708 | - | |||||||||||||||||||||||||
1709 | - | |||||||||||||||||||||||||
1710 | - | |||||||||||||||||||||||||
1711 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1712 | - | |||||||||||||||||||||||||
1713 | - | |||||||||||||||||||||||||
1714 | void QGuiApplicationPrivate::processGestureEvent(QWindowSystemInterfacePrivate::GestureEvent *e) | - | ||||||||||||||||||||||||
1715 | { | - | ||||||||||||||||||||||||
1716 | if (e->window.isNull()) | - | ||||||||||||||||||||||||
1717 | return; | - | ||||||||||||||||||||||||
1718 | - | |||||||||||||||||||||||||
1719 | QNativeGestureEvent ev(e->type, e->pos, e->pos, e->globalPos, e->realValue, e->sequenceId, e->intValue); | - | ||||||||||||||||||||||||
1720 | ev.setTimestamp(e->timestamp); | - | ||||||||||||||||||||||||
1721 | QGuiApplication::sendSpontaneousEvent(e->window, &ev); | - | ||||||||||||||||||||||||
1722 | } | - | ||||||||||||||||||||||||
1723 | - | |||||||||||||||||||||||||
1724 | - | |||||||||||||||||||||||||
1725 | void QGuiApplicationPrivate::processPlatformPanelEvent(QWindowSystemInterfacePrivate::PlatformPanelEvent *e) | - | ||||||||||||||||||||||||
1726 | { | - | ||||||||||||||||||||||||
1727 | if (!e->window) | - | ||||||||||||||||||||||||
1728 | return; | - | ||||||||||||||||||||||||
1729 | - | |||||||||||||||||||||||||
1730 | if (e->window->d_func()->blockedByModalWindow) { | - | ||||||||||||||||||||||||
1731 | - | |||||||||||||||||||||||||
1732 | return; | - | ||||||||||||||||||||||||
1733 | } | - | ||||||||||||||||||||||||
1734 | - | |||||||||||||||||||||||||
1735 | QEvent ev(QEvent::PlatformPanel); | - | ||||||||||||||||||||||||
1736 | QGuiApplication::sendSpontaneousEvent(e->window.data(), &ev); | - | ||||||||||||||||||||||||
1737 | } | - | ||||||||||||||||||||||||
1738 | - | |||||||||||||||||||||||||
1739 | - | |||||||||||||||||||||||||
1740 | void QGuiApplicationPrivate::processContextMenuEvent(QWindowSystemInterfacePrivate::ContextMenuEvent *e) | - | ||||||||||||||||||||||||
1741 | { | - | ||||||||||||||||||||||||
1742 | - | |||||||||||||||||||||||||
1743 | - | |||||||||||||||||||||||||
1744 | if (!e->window || e->mouseTriggered || e->window->d_func()->blockedByModalWindow) | - | ||||||||||||||||||||||||
1745 | return; | - | ||||||||||||||||||||||||
1746 | - | |||||||||||||||||||||||||
1747 | QContextMenuEvent ev(QContextMenuEvent::Keyboard, e->pos, e->globalPos, e->modifiers); | - | ||||||||||||||||||||||||
1748 | QGuiApplication::sendSpontaneousEvent(e->window.data(), &ev); | - | ||||||||||||||||||||||||
1749 | } | - | ||||||||||||||||||||||||
1750 | - | |||||||||||||||||||||||||
1751 | - | |||||||||||||||||||||||||
1752 | __attribute__((visibility("default"))) uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k) | - | ||||||||||||||||||||||||
1753 | { | - | ||||||||||||||||||||||||
1754 | return qHash(k.device) + k.touchPointId; | - | ||||||||||||||||||||||||
1755 | } | - | ||||||||||||||||||||||||
1756 | - | |||||||||||||||||||||||||
1757 | __attribute__((visibility("default"))) bool operator==(const QGuiApplicationPrivate::ActiveTouchPointsKey &a, | - | ||||||||||||||||||||||||
1758 | const QGuiApplicationPrivate::ActiveTouchPointsKey &b) | - | ||||||||||||||||||||||||
1759 | { | - | ||||||||||||||||||||||||
1760 | return a.device == b.device | - | ||||||||||||||||||||||||
1761 | && a.touchPointId == b.touchPointId; | - | ||||||||||||||||||||||||
1762 | } | - | ||||||||||||||||||||||||
1763 | - | |||||||||||||||||||||||||
1764 | void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e) | - | ||||||||||||||||||||||||
1765 | { | - | ||||||||||||||||||||||||
1766 | QGuiApplicationPrivate *d = self; | - | ||||||||||||||||||||||||
1767 | modifier_buttons = e->modifiers; | - | ||||||||||||||||||||||||
1768 | - | |||||||||||||||||||||||||
1769 | if (e->touchType == QEvent::TouchCancel
| 0 | ||||||||||||||||||||||||
1770 | - | |||||||||||||||||||||||||
1771 | - | |||||||||||||||||||||||||
1772 | QTouchEvent touchEvent(QEvent::TouchCancel, e->device, e->modifiers); | - | ||||||||||||||||||||||||
1773 | touchEvent.setTimestamp(e->timestamp); | - | ||||||||||||||||||||||||
1774 | QHash<ActiveTouchPointsKey, ActiveTouchPointsValue>::const_iterator it | - | ||||||||||||||||||||||||
1775 | = self->activeTouchPoints.constBegin(), ite = self->activeTouchPoints.constEnd(); | - | ||||||||||||||||||||||||
1776 | QSet<QWindow *> windowsNeedingCancel; | - | ||||||||||||||||||||||||
1777 | while (it != ite
| 0 | ||||||||||||||||||||||||
1778 | QWindow *w = it->window.data(); | - | ||||||||||||||||||||||||
1779 | if (w
| 0 | ||||||||||||||||||||||||
1780 | windowsNeedingCancel.insert(w); never executed: windowsNeedingCancel.insert(w); | 0 | ||||||||||||||||||||||||
1781 | ++it; | - | ||||||||||||||||||||||||
1782 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1783 | for (QSet<QWindow *>::const_iterator winIt = windowsNeedingCancel.constBegin(), | - | ||||||||||||||||||||||||
1784 | winItEnd = windowsNeedingCancel.constEnd(); winIt != winItEnd
| 0 | ||||||||||||||||||||||||
1785 | touchEvent.setWindow(*winIt); | - | ||||||||||||||||||||||||
1786 | QGuiApplication::sendSpontaneousEvent(*winIt, &touchEvent); | - | ||||||||||||||||||||||||
1787 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1788 | if (!self->synthesizedMousePoints.isEmpty()
| 0 | ||||||||||||||||||||||||
1789 | for (QHash<QWindow *, SynthesizedMouseData>::const_iterator synthIt = self->synthesizedMousePoints.constBegin(), | - | ||||||||||||||||||||||||
1790 | synthItEnd = self->synthesizedMousePoints.constEnd(); synthIt != synthItEnd
| 0 | ||||||||||||||||||||||||
1791 | if (!synthIt->window
| 0 | ||||||||||||||||||||||||
1792 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
1793 | QWindowSystemInterfacePrivate::MouseEvent fake(synthIt->window.data(), | - | ||||||||||||||||||||||||
1794 | e->timestamp, | - | ||||||||||||||||||||||||
1795 | synthIt->pos, | - | ||||||||||||||||||||||||
1796 | synthIt->screenPos, | - | ||||||||||||||||||||||||
1797 | buttons & ~Qt::LeftButton, | - | ||||||||||||||||||||||||
1798 | e->modifiers, | - | ||||||||||||||||||||||||
1799 | Qt::MouseEventSynthesizedByQt); | - | ||||||||||||||||||||||||
1800 | fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic; | - | ||||||||||||||||||||||||
1801 | processMouseEvent(&fake); | - | ||||||||||||||||||||||||
1802 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1803 | self->synthesizedMousePoints.clear(); | - | ||||||||||||||||||||||||
1804 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1805 | self->activeTouchPoints.clear(); | - | ||||||||||||||||||||||||
1806 | self->lastTouchType = e->touchType; | - | ||||||||||||||||||||||||
1807 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1808 | } | - | ||||||||||||||||||||||||
1809 | - | |||||||||||||||||||||||||
1810 | - | |||||||||||||||||||||||||
1811 | if (self->lastTouchType == QEvent::TouchCancel
| 0 | ||||||||||||||||||||||||
1812 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1813 | - | |||||||||||||||||||||||||
1814 | self->lastTouchType = e->touchType; | - | ||||||||||||||||||||||||
1815 | - | |||||||||||||||||||||||||
1816 | QWindow *window = e->window.data(); | - | ||||||||||||||||||||||||
1817 | typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints; | - | ||||||||||||||||||||||||
1818 | QHash<QWindow *, StatesAndTouchPoints> windowsNeedingEvents; | - | ||||||||||||||||||||||||
1819 | - | |||||||||||||||||||||||||
1820 | for (int i = 0; i < e->points.count()
| 0 | ||||||||||||||||||||||||
1821 | QTouchEvent::TouchPoint touchPoint = e->points.at(i); | - | ||||||||||||||||||||||||
1822 | - | |||||||||||||||||||||||||
1823 | - | |||||||||||||||||||||||||
1824 | - | |||||||||||||||||||||||||
1825 | touchPoint.d = touchPoint.d->detach(); | - | ||||||||||||||||||||||||
1826 | - | |||||||||||||||||||||||||
1827 | - | |||||||||||||||||||||||||
1828 | QPointer<QWindow> w; | - | ||||||||||||||||||||||||
1829 | QTouchEvent::TouchPoint previousTouchPoint; | - | ||||||||||||||||||||||||
1830 | ActiveTouchPointsKey touchInfoKey(e->device, touchPoint.id()); | - | ||||||||||||||||||||||||
1831 | ActiveTouchPointsValue &touchInfo = d->activeTouchPoints[touchInfoKey]; | - | ||||||||||||||||||||||||
1832 | switch (touchPoint.state()) { | - | ||||||||||||||||||||||||
1833 | case never executed: Qt::TouchPointPressed:case Qt::TouchPointPressed: never executed: case Qt::TouchPointPressed: | 0 | ||||||||||||||||||||||||
1834 | if (e->device->type() == QTouchDevice::TouchPad
| 0 | ||||||||||||||||||||||||
1835 | - | |||||||||||||||||||||||||
1836 | w = d->activeTouchPoints.isEmpty()
| 0 | ||||||||||||||||||||||||
1837 | ? QPointer<QWindow>() | - | ||||||||||||||||||||||||
1838 | : d->activeTouchPoints.constBegin().value().window; | - | ||||||||||||||||||||||||
1839 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1840 | - | |||||||||||||||||||||||||
1841 | if (!w
| 0 | ||||||||||||||||||||||||
1842 | - | |||||||||||||||||||||||||
1843 | if (!window
| 0 | ||||||||||||||||||||||||
1844 | window = QGuiApplication::topLevelAt(touchPoint.screenPos().toPoint()); never executed: window = QGuiApplication::topLevelAt(touchPoint.screenPos().toPoint()); | 0 | ||||||||||||||||||||||||
1845 | if (!window
| 0 | ||||||||||||||||||||||||
1846 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
1847 | w = window; | - | ||||||||||||||||||||||||
1848 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1849 | - | |||||||||||||||||||||||||
1850 | touchInfo.window = w; | - | ||||||||||||||||||||||||
1851 | touchPoint.d->startScreenPos = touchPoint.screenPos(); | - | ||||||||||||||||||||||||
1852 | touchPoint.d->lastScreenPos = touchPoint.screenPos(); | - | ||||||||||||||||||||||||
1853 | touchPoint.d->startNormalizedPos = touchPoint.normalizedPos(); | - | ||||||||||||||||||||||||
1854 | touchPoint.d->lastNormalizedPos = touchPoint.normalizedPos(); | - | ||||||||||||||||||||||||
1855 | if (touchPoint.pressure() < qreal(0.)
| 0 | ||||||||||||||||||||||||
1856 | touchPoint.d->pressure = qreal(1.); never executed: touchPoint.d->pressure = qreal(1.); | 0 | ||||||||||||||||||||||||
1857 | - | |||||||||||||||||||||||||
1858 | touchInfo.touchPoint = touchPoint; | - | ||||||||||||||||||||||||
1859 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1860 | - | |||||||||||||||||||||||||
1861 | case never executed: Qt::TouchPointReleased:case Qt::TouchPointReleased: never executed: case Qt::TouchPointReleased: | 0 | ||||||||||||||||||||||||
1862 | w = touchInfo.window; | - | ||||||||||||||||||||||||
1863 | if (!w
| 0 | ||||||||||||||||||||||||
1864 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
1865 | - | |||||||||||||||||||||||||
1866 | previousTouchPoint = touchInfo.touchPoint; | - | ||||||||||||||||||||||||
1867 | touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos(); | - | ||||||||||||||||||||||||
1868 | touchPoint.d->lastScreenPos = previousTouchPoint.screenPos(); | - | ||||||||||||||||||||||||
1869 | touchPoint.d->startPos = previousTouchPoint.startPos(); | - | ||||||||||||||||||||||||
1870 | touchPoint.d->lastPos = previousTouchPoint.pos(); | - | ||||||||||||||||||||||||
1871 | touchPoint.d->startNormalizedPos = previousTouchPoint.startNormalizedPos(); | - | ||||||||||||||||||||||||
1872 | touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos(); | - | ||||||||||||||||||||||||
1873 | if (touchPoint.pressure() < qreal(0.)
| 0 | ||||||||||||||||||||||||
1874 | touchPoint.d->pressure = qreal(0.); never executed: touchPoint.d->pressure = qreal(0.); | 0 | ||||||||||||||||||||||||
1875 | - | |||||||||||||||||||||||||
1876 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1877 | - | |||||||||||||||||||||||||
1878 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
1879 | w = touchInfo.window; | - | ||||||||||||||||||||||||
1880 | if (!w
| 0 | ||||||||||||||||||||||||
1881 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
1882 | - | |||||||||||||||||||||||||
1883 | previousTouchPoint = touchInfo.touchPoint; | - | ||||||||||||||||||||||||
1884 | touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos(); | - | ||||||||||||||||||||||||
1885 | touchPoint.d->lastScreenPos = previousTouchPoint.screenPos(); | - | ||||||||||||||||||||||||
1886 | touchPoint.d->startPos = previousTouchPoint.startPos(); | - | ||||||||||||||||||||||||
1887 | touchPoint.d->lastPos = previousTouchPoint.pos(); | - | ||||||||||||||||||||||||
1888 | touchPoint.d->startNormalizedPos = previousTouchPoint.startNormalizedPos(); | - | ||||||||||||||||||||||||
1889 | touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos(); | - | ||||||||||||||||||||||||
1890 | if (touchPoint.pressure() < qreal(0.)
| 0 | ||||||||||||||||||||||||
1891 | touchPoint.d->pressure = qreal(1.); never executed: touchPoint.d->pressure = qreal(1.); | 0 | ||||||||||||||||||||||||
1892 | - | |||||||||||||||||||||||||
1893 | - | |||||||||||||||||||||||||
1894 | - | |||||||||||||||||||||||||
1895 | if (touchPoint.state() != Qt::TouchPointStationary
| 0 | ||||||||||||||||||||||||
1896 | touchInfo.touchPoint = touchPoint; never executed: touchInfo.touchPoint = touchPoint; | 0 | ||||||||||||||||||||||||
1897 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1898 | } | - | ||||||||||||||||||||||||
1899 | - | |||||||||||||||||||||||||
1900 | ((!(w.data() != 0)) ? qt_assert("w.data() != 0",__FILE__,24892538) : qt_noop()); | - | ||||||||||||||||||||||||
1901 | - | |||||||||||||||||||||||||
1902 | - | |||||||||||||||||||||||||
1903 | touchPoint.d->sceneRect = touchPoint.screenRect(); | - | ||||||||||||||||||||||||
1904 | touchPoint.d->startScenePos = touchPoint.startScreenPos(); | - | ||||||||||||||||||||||||
1905 | touchPoint.d->lastScenePos = touchPoint.lastScreenPos(); | - | ||||||||||||||||||||||||
1906 | - | |||||||||||||||||||||||||
1907 | StatesAndTouchPoints &maskAndPoints = windowsNeedingEvents[w.data()]; | - | ||||||||||||||||||||||||
1908 | maskAndPoints.first |= touchPoint.state(); | - | ||||||||||||||||||||||||
1909 | maskAndPoints.second.append(touchPoint); | - | ||||||||||||||||||||||||
1910 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1911 | - | |||||||||||||||||||||||||
1912 | if (windowsNeedingEvents.isEmpty()
| 0 | ||||||||||||||||||||||||
1913 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1914 | - | |||||||||||||||||||||||||
1915 | QHash<QWindow *, StatesAndTouchPoints>::ConstIterator it = windowsNeedingEvents.constBegin(); | - | ||||||||||||||||||||||||
1916 | const QHash<QWindow *, StatesAndTouchPoints>::ConstIterator end = windowsNeedingEvents.constEnd(); | - | ||||||||||||||||||||||||
1917 | for (; it != end
| 0 | ||||||||||||||||||||||||
1918 | QWindow *w = it.key(); | - | ||||||||||||||||||||||||
1919 | - | |||||||||||||||||||||||||
1920 | QEvent::Type eventType; | - | ||||||||||||||||||||||||
1921 | switch (it.value().first) { | - | ||||||||||||||||||||||||
1922 | case never executed: Qt::TouchPointPressed:case Qt::TouchPointPressed: never executed: case Qt::TouchPointPressed: | 0 | ||||||||||||||||||||||||
1923 | eventType = QEvent::TouchBegin; | - | ||||||||||||||||||||||||
1924 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1925 | case never executed: Qt::TouchPointReleased:case Qt::TouchPointReleased: never executed: case Qt::TouchPointReleased: | 0 | ||||||||||||||||||||||||
1926 | eventType = QEvent::TouchEnd; | - | ||||||||||||||||||||||||
1927 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1928 | case never executed: Qt::TouchPointStationary:case Qt::TouchPointStationary: never executed: case Qt::TouchPointStationary: | 0 | ||||||||||||||||||||||||
1929 | - | |||||||||||||||||||||||||
1930 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
1931 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
1932 | eventType = QEvent::TouchUpdate; | - | ||||||||||||||||||||||||
1933 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1934 | } | - | ||||||||||||||||||||||||
1935 | - | |||||||||||||||||||||||||
1936 | if (w->d_func()->blockedByModalWindow
| 0 | ||||||||||||||||||||||||
1937 | - | |||||||||||||||||||||||||
1938 | - | |||||||||||||||||||||||||
1939 | - | |||||||||||||||||||||||||
1940 | if (eventType == QEvent::TouchEnd
| 0 | ||||||||||||||||||||||||
1941 | - | |||||||||||||||||||||||||
1942 | - | |||||||||||||||||||||||||
1943 | QTouchEvent touchEvent(QEvent::TouchCancel, | - | ||||||||||||||||||||||||
1944 | e->device, | - | ||||||||||||||||||||||||
1945 | e->modifiers); | - | ||||||||||||||||||||||||
1946 | touchEvent.setTimestamp(e->timestamp); | - | ||||||||||||||||||||||||
1947 | touchEvent.setWindow(w); | - | ||||||||||||||||||||||||
1948 | QGuiApplication::sendSpontaneousEvent(w, &touchEvent); | - | ||||||||||||||||||||||||
1949 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1950 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
1951 | } | - | ||||||||||||||||||||||||
1952 | - | |||||||||||||||||||||||||
1953 | QTouchEvent touchEvent(eventType, | - | ||||||||||||||||||||||||
1954 | e->device, | - | ||||||||||||||||||||||||
1955 | e->modifiers, | - | ||||||||||||||||||||||||
1956 | it.value().first, | - | ||||||||||||||||||||||||
1957 | it.value().second); | - | ||||||||||||||||||||||||
1958 | touchEvent.setTimestamp(e->timestamp); | - | ||||||||||||||||||||||||
1959 | touchEvent.setWindow(w); | - | ||||||||||||||||||||||||
1960 | - | |||||||||||||||||||||||||
1961 | const int pointCount = touchEvent.touchPoints().count(); | - | ||||||||||||||||||||||||
1962 | for (int i = 0; i < pointCount
| 0 | ||||||||||||||||||||||||
1963 | QTouchEvent::TouchPoint &touchPoint = touchEvent._touchPoints[i]; | - | ||||||||||||||||||||||||
1964 | - | |||||||||||||||||||||||||
1965 | - | |||||||||||||||||||||||||
1966 | QRectF rect = touchPoint.screenRect(); | - | ||||||||||||||||||||||||
1967 | const QPointF screenPos = rect.center(); | - | ||||||||||||||||||||||||
1968 | const QPointF delta = screenPos - screenPos.toPoint(); | - | ||||||||||||||||||||||||
1969 | - | |||||||||||||||||||||||||
1970 | rect.moveCenter(w->mapFromGlobal(screenPos.toPoint()) + delta); | - | ||||||||||||||||||||||||
1971 | touchPoint.d->rect = rect; | - | ||||||||||||||||||||||||
1972 | if (touchPoint.state() == Qt::TouchPointPressed
| 0 | ||||||||||||||||||||||||
1973 | touchPoint.d->startPos = w->mapFromGlobal(touchPoint.startScreenPos().toPoint()) + delta; | - | ||||||||||||||||||||||||
1974 | touchPoint.d->lastPos = w->mapFromGlobal(touchPoint.lastScreenPos().toPoint()) + delta; | - | ||||||||||||||||||||||||
1975 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1976 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1977 | - | |||||||||||||||||||||||||
1978 | QGuiApplication::sendSpontaneousEvent(w, &touchEvent); | - | ||||||||||||||||||||||||
1979 | if (!e->synthetic()
| 0 | ||||||||||||||||||||||||
1980 | - | |||||||||||||||||||||||||
1981 | if (!(touchEvent.device()->capabilities() & QTouchDevice::MouseEmulation)
| 0 | ||||||||||||||||||||||||
1982 | Qt::MouseButtons b = eventType == QEvent::TouchEnd
| 0 | ||||||||||||||||||||||||
1983 | if (b == Qt::NoButton
| 0 | ||||||||||||||||||||||||
1984 | self->synthesizedMousePoints.clear(); never executed: self->synthesizedMousePoints.clear(); | 0 | ||||||||||||||||||||||||
1985 | - | |||||||||||||||||||||||||
1986 | const QList<QTouchEvent::TouchPoint> touchPoints&touchPoints = touchEvent.touchPoints(); | - | ||||||||||||||||||||||||
1987 | if (eventType == QEvent::TouchBegin
| 0 | ||||||||||||||||||||||||
1988 | m_fakeMouseSourcePointId = touchPoints.first().id(); never executed: m_fakeMouseSourcePointId = touchPoints.first().id(); | 0 | ||||||||||||||||||||||||
1989 | - | |||||||||||||||||||||||||
1990 | for (int i = 0; i < touchPoints.count()
| 0 | ||||||||||||||||||||||||
1991 | const QTouchEvent::TouchPoint &touchPoint = touchPoints.at(i); | - | ||||||||||||||||||||||||
1992 | if (touchPoint.id() == m_fakeMouseSourcePointId
| 0 | ||||||||||||||||||||||||
1993 | if (b != Qt::NoButton
| 0 | ||||||||||||||||||||||||
1994 | self->synthesizedMousePoints.insert(w, SynthesizedMouseData( never executed: self->synthesizedMousePoints.insert(w, SynthesizedMouseData( touchPoint.pos(), touchPoint.screenPos(), w)); | 0 | ||||||||||||||||||||||||
1995 | touchPoint.pos(), touchPoint.screenPos(), w)); never executed: self->synthesizedMousePoints.insert(w, SynthesizedMouseData( touchPoint.pos(), touchPoint.screenPos(), w)); | 0 | ||||||||||||||||||||||||
1996 | QWindowSystemInterfacePrivate::MouseEvent fake(w, e->timestamp, | - | ||||||||||||||||||||||||
1997 | touchPoint.pos(), | - | ||||||||||||||||||||||||
1998 | touchPoint.screenPos(), | - | ||||||||||||||||||||||||
1999 | b | (buttons & ~Qt::LeftButton), | - | ||||||||||||||||||||||||
2000 | e->modifiers, | - | ||||||||||||||||||||||||
2001 | Qt::MouseEventSynthesizedByQt); | - | ||||||||||||||||||||||||
2002 | fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic; | - | ||||||||||||||||||||||||
2003 | processMouseEvent(&fake); | - | ||||||||||||||||||||||||
2004 | break; never executed: break; | 0 | ||||||||||||||||||||||||
2005 | } | - | ||||||||||||||||||||||||
2006 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2007 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2008 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2009 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2010 | - | |||||||||||||||||||||||||
2011 | - | |||||||||||||||||||||||||
2012 | - | |||||||||||||||||||||||||
2013 | - | |||||||||||||||||||||||||
2014 | - | |||||||||||||||||||||||||
2015 | for (int i = 0; i < e->points.count()
| 0 | ||||||||||||||||||||||||
2016 | QTouchEvent::TouchPoint touchPoint = e->points.at(i); | - | ||||||||||||||||||||||||
2017 | if (touchPoint.state() == Qt::TouchPointReleased
| 0 | ||||||||||||||||||||||||
2018 | d->activeTouchPoints.remove(ActiveTouchPointsKey(e->device, touchPoint.id())); never executed: d->activeTouchPoints.remove(ActiveTouchPointsKey(e->device, touchPoint.id())); | 0 | ||||||||||||||||||||||||
2019 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2020 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2021 | - | |||||||||||||||||||||||||
2022 | void QGuiApplicationPrivate::reportScreenOrientationChange(QWindowSystemInterfacePrivate::ScreenOrientationEvent *e) | - | ||||||||||||||||||||||||
2023 | { | - | ||||||||||||||||||||||||
2024 | - | |||||||||||||||||||||||||
2025 | if (QCoreApplication::startingUp()) | - | ||||||||||||||||||||||||
2026 | return; | - | ||||||||||||||||||||||||
2027 | - | |||||||||||||||||||||||||
2028 | if (!e->screen) | - | ||||||||||||||||||||||||
2029 | return; | - | ||||||||||||||||||||||||
2030 | - | |||||||||||||||||||||||||
2031 | QScreen *s = e->screen.data(); | - | ||||||||||||||||||||||||
2032 | s->d_func()->orientation = e->orientation; | - | ||||||||||||||||||||||||
2033 | - | |||||||||||||||||||||||||
2034 | updateFilteredScreenOrientation(s); | - | ||||||||||||||||||||||||
2035 | } | - | ||||||||||||||||||||||||
2036 | - | |||||||||||||||||||||||||
2037 | void QGuiApplicationPrivate::updateFilteredScreenOrientation(QScreen *s) | - | ||||||||||||||||||||||||
2038 | { | - | ||||||||||||||||||||||||
2039 | Qt::ScreenOrientation o = s->d_func()->orientation; | - | ||||||||||||||||||||||||
2040 | if (o == Qt::PrimaryOrientation) | - | ||||||||||||||||||||||||
2041 | o = s->primaryOrientation(); | - | ||||||||||||||||||||||||
2042 | o = Qt::ScreenOrientation(o & s->orientationUpdateMask()); | - | ||||||||||||||||||||||||
2043 | if (o == Qt::PrimaryOrientation) | - | ||||||||||||||||||||||||
2044 | return; | - | ||||||||||||||||||||||||
2045 | if (o == s->d_func()->filteredOrientation) | - | ||||||||||||||||||||||||
2046 | return; | - | ||||||||||||||||||||||||
2047 | s->d_func()->filteredOrientation = o; | - | ||||||||||||||||||||||||
2048 | reportScreenOrientationChange(s); | - | ||||||||||||||||||||||||
2049 | } | - | ||||||||||||||||||||||||
2050 | - | |||||||||||||||||||||||||
2051 | void QGuiApplicationPrivate::reportScreenOrientationChange(QScreen *s) | - | ||||||||||||||||||||||||
2052 | { | - | ||||||||||||||||||||||||
2053 | s->orientationChanged(s->orientation()); | - | ||||||||||||||||||||||||
2054 | - | |||||||||||||||||||||||||
2055 | QScreenOrientationChangeEvent event(s, s->orientation()); | - | ||||||||||||||||||||||||
2056 | QCoreApplication::sendEvent(QCoreApplication::instance(), &event); | - | ||||||||||||||||||||||||
2057 | } | - | ||||||||||||||||||||||||
2058 | - | |||||||||||||||||||||||||
2059 | void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e) | - | ||||||||||||||||||||||||
2060 | { | - | ||||||||||||||||||||||||
2061 | - | |||||||||||||||||||||||||
2062 | if (QCoreApplication::startingUp()
| 0 | ||||||||||||||||||||||||
2063 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2064 | - | |||||||||||||||||||||||||
2065 | if (!e->screen
| 0 | ||||||||||||||||||||||||
2066 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2067 | - | |||||||||||||||||||||||||
2068 | QScreen *s = e->screen.data(); | - | ||||||||||||||||||||||||
2069 | - | |||||||||||||||||||||||||
2070 | bool geometryChanged = e->geometry != s->d_func()->geometry; | - | ||||||||||||||||||||||||
2071 | s->d_func()->geometry = e->geometry; | - | ||||||||||||||||||||||||
2072 | - | |||||||||||||||||||||||||
2073 | bool availableGeometryChanged = e->availableGeometry != s->d_func()->availableGeometry; | - | ||||||||||||||||||||||||
2074 | s->d_func()->availableGeometry = e->availableGeometry; | - | ||||||||||||||||||||||||
2075 | - | |||||||||||||||||||||||||
2076 | if (geometryChanged
| 0 | ||||||||||||||||||||||||
2077 | Qt::ScreenOrientation primaryOrientation = s->primaryOrientation(); | - | ||||||||||||||||||||||||
2078 | s->d_func()->updatePrimaryOrientation(); | - | ||||||||||||||||||||||||
2079 | - | |||||||||||||||||||||||||
2080 | s->geometryChanged(s->geometry()); | - | ||||||||||||||||||||||||
2081 | s->physicalSizeChanged(s->physicalSize()); | - | ||||||||||||||||||||||||
2082 | s->physicalDotsPerInchChanged(s->physicalDotsPerInch()); | - | ||||||||||||||||||||||||
2083 | s->logicalDotsPerInchChanged(s->logicalDotsPerInch()); | - | ||||||||||||||||||||||||
2084 | - | |||||||||||||||||||||||||
2085 | if (s->primaryOrientation() != primaryOrientation
| 0 | ||||||||||||||||||||||||
2086 | s->primaryOrientationChanged(s->primaryOrientation()); never executed: s->primaryOrientationChanged(s->primaryOrientation()); | 0 | ||||||||||||||||||||||||
2087 | - | |||||||||||||||||||||||||
2088 | if (s->d_func()->orientation == Qt::PrimaryOrientation
| 0 | ||||||||||||||||||||||||
2089 | updateFilteredScreenOrientation(s); never executed: updateFilteredScreenOrientation(s); | 0 | ||||||||||||||||||||||||
2090 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2091 | - | |||||||||||||||||||||||||
2092 | if (availableGeometryChanged
| 0 | ||||||||||||||||||||||||
2093 | s->availableGeometryChanged(s->availableGeometry()); never executed: s->availableGeometryChanged(s->availableGeometry()); | 0 | ||||||||||||||||||||||||
2094 | - | |||||||||||||||||||||||||
2095 | if (geometryChanged
| 0 | ||||||||||||||||||||||||
2096 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(s->virtualSiblings())>::type> _container_((const auto siblings = s->virtualSiblings())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)(); | - | ||||||||||||||||||||||||
2097 | for (QScreen* sibling = *_container_.i; _container_.control; _container_.control = 0: siblings) | - | ||||||||||||||||||||||||
2098 | sibling->virtualGeometryChanged(sibling->virtualGeometry()); never executed: sibling->virtualGeometryChanged(sibling->virtualGeometry()); | 0 | ||||||||||||||||||||||||
2099 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2100 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2101 | - | |||||||||||||||||||||||||
2102 | void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e) | - | ||||||||||||||||||||||||
2103 | { | - | ||||||||||||||||||||||||
2104 | - | |||||||||||||||||||||||||
2105 | if (QCoreApplication::startingUp()) | - | ||||||||||||||||||||||||
2106 | return; | - | ||||||||||||||||||||||||
2107 | - | |||||||||||||||||||||||||
2108 | if (!e->screen) | - | ||||||||||||||||||||||||
2109 | return; | - | ||||||||||||||||||||||||
2110 | - | |||||||||||||||||||||||||
2111 | QScreen *s = e->screen.data(); | - | ||||||||||||||||||||||||
2112 | s->d_func()->logicalDpi = QDpi(e->dpiX, e->dpiY); | - | ||||||||||||||||||||||||
2113 | - | |||||||||||||||||||||||||
2114 | s->logicalDotsPerInchChanged(s->logicalDotsPerInch()); | - | ||||||||||||||||||||||||
2115 | } | - | ||||||||||||||||||||||||
2116 | - | |||||||||||||||||||||||||
2117 | void QGuiApplicationPrivate::reportRefreshRateChange(QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e) | - | ||||||||||||||||||||||||
2118 | { | - | ||||||||||||||||||||||||
2119 | - | |||||||||||||||||||||||||
2120 | if (QCoreApplication::startingUp()) | - | ||||||||||||||||||||||||
2121 | return; | - | ||||||||||||||||||||||||
2122 | - | |||||||||||||||||||||||||
2123 | if (!e->screen) | - | ||||||||||||||||||||||||
2124 | return; | - | ||||||||||||||||||||||||
2125 | - | |||||||||||||||||||||||||
2126 | QScreen *s = e->screen.data(); | - | ||||||||||||||||||||||||
2127 | qreal rate = e->rate; | - | ||||||||||||||||||||||||
2128 | - | |||||||||||||||||||||||||
2129 | if (rate < 1.0) | - | ||||||||||||||||||||||||
2130 | rate = 60.0; | - | ||||||||||||||||||||||||
2131 | if (!qFuzzyCompare(s->d_func()->refreshRate, rate)) { | - | ||||||||||||||||||||||||
2132 | s->d_func()->refreshRate = rate; | - | ||||||||||||||||||||||||
2133 | s->refreshRateChanged(s->refreshRate()); | - | ||||||||||||||||||||||||
2134 | } | - | ||||||||||||||||||||||||
2135 | } | - | ||||||||||||||||||||||||
2136 | - | |||||||||||||||||||||||||
2137 | void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e) | - | ||||||||||||||||||||||||
2138 | { | - | ||||||||||||||||||||||||
2139 | if (!e->exposed) | - | ||||||||||||||||||||||||
2140 | return; | - | ||||||||||||||||||||||||
2141 | - | |||||||||||||||||||||||||
2142 | QWindow *window = e->exposed.data(); | - | ||||||||||||||||||||||||
2143 | if (!window) | - | ||||||||||||||||||||||||
2144 | return; | - | ||||||||||||||||||||||||
2145 | QWindowPrivate *p = qt_window_private(window); | - | ||||||||||||||||||||||||
2146 | - | |||||||||||||||||||||||||
2147 | if (!p->receivedExpose) { | - | ||||||||||||||||||||||||
2148 | if (p->resizeEventPending) { | - | ||||||||||||||||||||||||
2149 | - | |||||||||||||||||||||||||
2150 | - | |||||||||||||||||||||||||
2151 | QResizeEvent e(window->geometry().size(), p->geometry.size()); | - | ||||||||||||||||||||||||
2152 | QGuiApplication::sendSpontaneousEvent(window, &e); | - | ||||||||||||||||||||||||
2153 | - | |||||||||||||||||||||||||
2154 | p->resizeEventPending = false; | - | ||||||||||||||||||||||||
2155 | } | - | ||||||||||||||||||||||||
2156 | - | |||||||||||||||||||||||||
2157 | p->receivedExpose = true; | - | ||||||||||||||||||||||||
2158 | } | - | ||||||||||||||||||||||||
2159 | - | |||||||||||||||||||||||||
2160 | p->exposed = e->isExposed && window->screen(); | - | ||||||||||||||||||||||||
2161 | - | |||||||||||||||||||||||||
2162 | QExposeEvent exposeEvent(e->region); | - | ||||||||||||||||||||||||
2163 | QCoreApplication::sendSpontaneousEvent(window, &exposeEvent); | - | ||||||||||||||||||||||||
2164 | } | - | ||||||||||||||||||||||||
2165 | - | |||||||||||||||||||||||||
2166 | - | |||||||||||||||||||||||||
2167 | - | |||||||||||||||||||||||||
2168 | QPlatformDragQtResponse QGuiApplicationPrivate::processDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions) | - | ||||||||||||||||||||||||
2169 | { | - | ||||||||||||||||||||||||
2170 | static QPointer<QWindow> currentDragWindow; | - | ||||||||||||||||||||||||
2171 | static Qt::DropAction lastAcceptedDropAction = Qt::IgnoreAction; | - | ||||||||||||||||||||||||
2172 | QPlatformDrag *platformDrag = platformIntegration()->drag(); | - | ||||||||||||||||||||||||
2173 | if (!platformDrag) { | - | ||||||||||||||||||||||||
2174 | lastAcceptedDropAction = Qt::IgnoreAction; | - | ||||||||||||||||||||||||
2175 | return QPlatformDragQtResponse(false, lastAcceptedDropAction, QRect()); | - | ||||||||||||||||||||||||
2176 | } | - | ||||||||||||||||||||||||
2177 | - | |||||||||||||||||||||||||
2178 | if (!dropData) { | - | ||||||||||||||||||||||||
2179 | if (currentDragWindow.data() == w) | - | ||||||||||||||||||||||||
2180 | currentDragWindow = 0; | - | ||||||||||||||||||||||||
2181 | QDragLeaveEvent e; | - | ||||||||||||||||||||||||
2182 | QGuiApplication::sendEvent(w, &e); | - | ||||||||||||||||||||||||
2183 | lastAcceptedDropAction = Qt::IgnoreAction; | - | ||||||||||||||||||||||||
2184 | return QPlatformDragQtResponse(false, lastAcceptedDropAction, QRect()); | - | ||||||||||||||||||||||||
2185 | } | - | ||||||||||||||||||||||||
2186 | QDragMoveEvent me(p, supportedActions, dropData, | - | ||||||||||||||||||||||||
2187 | QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers()); | - | ||||||||||||||||||||||||
2188 | - | |||||||||||||||||||||||||
2189 | if (w != currentDragWindow) { | - | ||||||||||||||||||||||||
2190 | lastAcceptedDropAction = Qt::IgnoreAction; | - | ||||||||||||||||||||||||
2191 | if (currentDragWindow) { | - | ||||||||||||||||||||||||
2192 | QDragLeaveEvent e; | - | ||||||||||||||||||||||||
2193 | QGuiApplication::sendEvent(currentDragWindow, &e); | - | ||||||||||||||||||||||||
2194 | } | - | ||||||||||||||||||||||||
2195 | currentDragWindow = w; | - | ||||||||||||||||||||||||
2196 | QDragEnterEvent e(p, supportedActions, dropData, | - | ||||||||||||||||||||||||
2197 | QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers()); | - | ||||||||||||||||||||||||
2198 | QGuiApplication::sendEvent(w, &e); | - | ||||||||||||||||||||||||
2199 | if (e.isAccepted() && e.dropAction() != Qt::IgnoreAction) | - | ||||||||||||||||||||||||
2200 | lastAcceptedDropAction = e.dropAction(); | - | ||||||||||||||||||||||||
2201 | } | - | ||||||||||||||||||||||||
2202 | - | |||||||||||||||||||||||||
2203 | - | |||||||||||||||||||||||||
2204 | if (lastAcceptedDropAction != Qt::IgnoreAction | - | ||||||||||||||||||||||||
2205 | && (supportedActions & lastAcceptedDropAction)) { | - | ||||||||||||||||||||||||
2206 | me.setDropAction(lastAcceptedDropAction); | - | ||||||||||||||||||||||||
2207 | me.accept(); | - | ||||||||||||||||||||||||
2208 | } | - | ||||||||||||||||||||||||
2209 | QGuiApplication::sendEvent(w, &me); | - | ||||||||||||||||||||||||
2210 | lastAcceptedDropAction = me.isAccepted() ? | - | ||||||||||||||||||||||||
2211 | me.dropAction() : Qt::IgnoreAction; | - | ||||||||||||||||||||||||
2212 | return QPlatformDragQtResponse(me.isAccepted(), lastAcceptedDropAction, me.answerRect()); | - | ||||||||||||||||||||||||
2213 | } | - | ||||||||||||||||||||||||
2214 | - | |||||||||||||||||||||||||
2215 | QPlatformDropQtResponse QGuiApplicationPrivate::processDrop(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions) | - | ||||||||||||||||||||||||
2216 | { | - | ||||||||||||||||||||||||
2217 | QDropEvent de(p, supportedActions, dropData, | - | ||||||||||||||||||||||||
2218 | QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers()); | - | ||||||||||||||||||||||||
2219 | QGuiApplication::sendEvent(w, &de); | - | ||||||||||||||||||||||||
2220 | - | |||||||||||||||||||||||||
2221 | Qt::DropAction acceptedAction = de.isAccepted() ? de.dropAction() : Qt::IgnoreAction; | - | ||||||||||||||||||||||||
2222 | QPlatformDropQtResponse response(de.isAccepted(),acceptedAction); | - | ||||||||||||||||||||||||
2223 | return response; | - | ||||||||||||||||||||||||
2224 | } | - | ||||||||||||||||||||||||
2225 | - | |||||||||||||||||||||||||
2226 | - | |||||||||||||||||||||||||
2227 | - | |||||||||||||||||||||||||
2228 | - | |||||||||||||||||||||||||
2229 | - | |||||||||||||||||||||||||
2230 | - | |||||||||||||||||||||||||
2231 | - | |||||||||||||||||||||||||
2232 | QClipboard * QGuiApplication::clipboard() | - | ||||||||||||||||||||||||
2233 | { | - | ||||||||||||||||||||||||
2234 | if (QGuiApplicationPrivate::qt_clipboard == 0) { | - | ||||||||||||||||||||||||
2235 | if (!(static_cast<QGuiApplication *>(QCoreApplication::instance()))) { | - | ||||||||||||||||||||||||
2236 | QMessageLogger(__FILE__, 28242874, __PRETTY_FUNCTION__).warning("QGuiApplication: Must construct a QGuiApplication before accessing a QClipboard"); | - | ||||||||||||||||||||||||
2237 | return 0; | - | ||||||||||||||||||||||||
2238 | } | - | ||||||||||||||||||||||||
2239 | QGuiApplicationPrivate::qt_clipboard = new QClipboard(0); | - | ||||||||||||||||||||||||
2240 | } | - | ||||||||||||||||||||||||
2241 | return QGuiApplicationPrivate::qt_clipboard; | - | ||||||||||||||||||||||||
2242 | } | - | ||||||||||||||||||||||||
2243 | QPalette QGuiApplication::palette() | - | ||||||||||||||||||||||||
2244 | { | - | ||||||||||||||||||||||||
2245 | initPalette(); | - | ||||||||||||||||||||||||
2246 | return *QGuiApplicationPrivate::app_pal; | - | ||||||||||||||||||||||||
2247 | } | - | ||||||||||||||||||||||||
2248 | - | |||||||||||||||||||||||||
2249 | - | |||||||||||||||||||||||||
2250 | - | |||||||||||||||||||||||||
2251 | - | |||||||||||||||||||||||||
2252 | - | |||||||||||||||||||||||||
2253 | - | |||||||||||||||||||||||||
2254 | void QGuiApplication::setPalette(const QPalette &pal) | - | ||||||||||||||||||||||||
2255 | { | - | ||||||||||||||||||||||||
2256 | if (QGuiApplicationPrivate::app_pal && pal.isCopyOf(*QGuiApplicationPrivate::app_pal)) | - | ||||||||||||||||||||||||
2257 | return; | - | ||||||||||||||||||||||||
2258 | if (!QGuiApplicationPrivate::app_pal) | - | ||||||||||||||||||||||||
2259 | QGuiApplicationPrivate::app_pal = new QPalette(pal); | - | ||||||||||||||||||||||||
2260 | else | - | ||||||||||||||||||||||||
2261 | *QGuiApplicationPrivate::app_pal = pal; | - | ||||||||||||||||||||||||
2262 | applicationResourceFlags |= ApplicationPaletteExplicitlySet; | - | ||||||||||||||||||||||||
2263 | QCoreApplication::setAttribute(Qt::AA_SetPalette); | - | ||||||||||||||||||||||||
2264 | (static_cast<QGuiApplication *>(QCoreApplication::instance()))->paletteChanged(*QGuiApplicationPrivate::app_pal); | - | ||||||||||||||||||||||||
2265 | } | - | ||||||||||||||||||||||||
2266 | - | |||||||||||||||||||||||||
2267 | void QGuiApplicationPrivate::applyWindowGeometrySpecificationTo(QWindow *window) | - | ||||||||||||||||||||||||
2268 | { | - | ||||||||||||||||||||||||
2269 | windowGeometrySpecification.applyTo(window); | - | ||||||||||||||||||||||||
2270 | } | - | ||||||||||||||||||||||||
2271 | - | |||||||||||||||||||||||||
2272 | - | |||||||||||||||||||||||||
2273 | - | |||||||||||||||||||||||||
2274 | - | |||||||||||||||||||||||||
2275 | - | |||||||||||||||||||||||||
2276 | - | |||||||||||||||||||||||||
2277 | QFont QGuiApplication::font() | - | ||||||||||||||||||||||||
2278 | { | - | ||||||||||||||||||||||||
2279 | ((!(QGuiApplicationPrivate::self)) ? qt_assert_x("QGuiApplication::font()", "no QGuiApplication instance",__FILE__,28842934) : qt_noop()); | - | ||||||||||||||||||||||||
2280 | QMutexLocker locker(&applicationFontMutex); | - | ||||||||||||||||||||||||
2281 | initFontUnlocked(); | - | ||||||||||||||||||||||||
2282 | return *QGuiApplicationPrivate::app_font; | - | ||||||||||||||||||||||||
2283 | } | - | ||||||||||||||||||||||||
2284 | - | |||||||||||||||||||||||||
2285 | - | |||||||||||||||||||||||||
2286 | - | |||||||||||||||||||||||||
2287 | - | |||||||||||||||||||||||||
2288 | - | |||||||||||||||||||||||||
2289 | - | |||||||||||||||||||||||||
2290 | void QGuiApplication::setFont(const QFont &font) | - | ||||||||||||||||||||||||
2291 | { | - | ||||||||||||||||||||||||
2292 | QMutexLocker locker(&applicationFontMutex); | - | ||||||||||||||||||||||||
2293 | if (!QGuiApplicationPrivate::app_font) | - | ||||||||||||||||||||||||
2294 | QGuiApplicationPrivate::app_font = new QFont(font); | - | ||||||||||||||||||||||||
2295 | else | - | ||||||||||||||||||||||||
2296 | *QGuiApplicationPrivate::app_font = font; | - | ||||||||||||||||||||||||
2297 | applicationResourceFlags |= ApplicationFontExplicitlySet; | - | ||||||||||||||||||||||||
2298 | } | - | ||||||||||||||||||||||||
2299 | void QGuiApplicationPrivate::notifyLayoutDirectionChange() | - | ||||||||||||||||||||||||
2300 | { | - | ||||||||||||||||||||||||
2301 | const QWindowList list = QGuiApplication::topLevelWindows(); | - | ||||||||||||||||||||||||
2302 | for (int i = 0; i < list.size(); ++i) { | - | ||||||||||||||||||||||||
2303 | QEvent ev(QEvent::ApplicationLayoutDirectionChange); | - | ||||||||||||||||||||||||
2304 | QCoreApplication::sendEvent(list.at(i), &ev); | - | ||||||||||||||||||||||||
2305 | } | - | ||||||||||||||||||||||||
2306 | } | - | ||||||||||||||||||||||||
2307 | - | |||||||||||||||||||||||||
2308 | void QGuiApplicationPrivate::notifyActiveWindowChange(QWindow *) | - | ||||||||||||||||||||||||
2309 | { | - | ||||||||||||||||||||||||
2310 | } | - | ||||||||||||||||||||||||
2311 | - | |||||||||||||||||||||||||
2312 | - | |||||||||||||||||||||||||
2313 | - | |||||||||||||||||||||||||
2314 | - | |||||||||||||||||||||||||
2315 | - | |||||||||||||||||||||||||
2316 | - | |||||||||||||||||||||||||
2317 | - | |||||||||||||||||||||||||
2318 | QIcon QGuiApplication::windowIcon() | - | ||||||||||||||||||||||||
2319 | { | - | ||||||||||||||||||||||||
2320 | return QGuiApplicationPrivate::app_icon ? *QGuiApplicationPrivate::app_icon : QIcon(); | - | ||||||||||||||||||||||||
2321 | } | - | ||||||||||||||||||||||||
2322 | - | |||||||||||||||||||||||||
2323 | void QGuiApplication::setWindowIcon(const QIcon &icon) | - | ||||||||||||||||||||||||
2324 | { | - | ||||||||||||||||||||||||
2325 | if (!QGuiApplicationPrivate::app_icon) | - | ||||||||||||||||||||||||
2326 | QGuiApplicationPrivate::app_icon = new QIcon(); | - | ||||||||||||||||||||||||
2327 | *QGuiApplicationPrivate::app_icon = icon; | - | ||||||||||||||||||||||||
2328 | if (QGuiApplicationPrivate::platform_integration | - | ||||||||||||||||||||||||
2329 | && QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::ApplicationIcon)) | - | ||||||||||||||||||||||||
2330 | QGuiApplicationPrivate::platform_integration->setApplicationIcon(icon); | - | ||||||||||||||||||||||||
2331 | if (QGuiApplicationPrivate::is_app_running && !QGuiApplicationPrivate::is_app_closing) | - | ||||||||||||||||||||||||
2332 | QGuiApplicationPrivate::self->notifyWindowIconChanged(); | - | ||||||||||||||||||||||||
2333 | } | - | ||||||||||||||||||||||||
2334 | - | |||||||||||||||||||||||||
2335 | void QGuiApplicationPrivate::notifyWindowIconChanged() | - | ||||||||||||||||||||||||
2336 | { | - | ||||||||||||||||||||||||
2337 | QEvent ev(QEvent::ApplicationWindowIconChange); | - | ||||||||||||||||||||||||
2338 | const QWindowList list = QGuiApplication::topLevelWindows(); | - | ||||||||||||||||||||||||
2339 | for (int i = 0; i < list.size(); ++i) | - | ||||||||||||||||||||||||
2340 | QCoreApplication::sendEvent(list.at(i), &ev); | - | ||||||||||||||||||||||||
2341 | } | - | ||||||||||||||||||||||||
2342 | void QGuiApplication::setQuitOnLastWindowClosed(bool quit) | - | ||||||||||||||||||||||||
2343 | { | - | ||||||||||||||||||||||||
2344 | QCoreApplication::setQuitLockEnabled(quit); | - | ||||||||||||||||||||||||
2345 | } | - | ||||||||||||||||||||||||
2346 | - | |||||||||||||||||||||||||
2347 | - | |||||||||||||||||||||||||
2348 | - | |||||||||||||||||||||||||
2349 | bool QGuiApplication::quitOnLastWindowClosed() | - | ||||||||||||||||||||||||
2350 | { | - | ||||||||||||||||||||||||
2351 | return QCoreApplication::isQuitLockEnabled(); | - | ||||||||||||||||||||||||
2352 | } | - | ||||||||||||||||||||||||
2353 | void QGuiApplicationPrivate::emitLastWindowClosed() | - | ||||||||||||||||||||||||
2354 | { | - | ||||||||||||||||||||||||
2355 | if ((static_cast<QGuiApplication *>(QCoreApplication::instance())) && (static_cast<QGuiApplication *>(QCoreApplication::instance()))->d_func()->in_exec) { | - | ||||||||||||||||||||||||
2356 | (static_cast<QGuiApplication *>(QCoreApplication::instance()))->lastWindowClosed(); | - | ||||||||||||||||||||||||
2357 | } | - | ||||||||||||||||||||||||
2358 | } | - | ||||||||||||||||||||||||
2359 | - | |||||||||||||||||||||||||
2360 | bool QGuiApplicationPrivate::shouldQuit() | - | ||||||||||||||||||||||||
2361 | { | - | ||||||||||||||||||||||||
2362 | const QWindowList processedWindows; | - | ||||||||||||||||||||||||
2363 | return shouldQuitInternal(processedWindows); | - | ||||||||||||||||||||||||
2364 | } | - | ||||||||||||||||||||||||
2365 | - | |||||||||||||||||||||||||
2366 | bool QGuiApplicationPrivate::shouldQuitInternal(const QWindowList &processedWindows) | - | ||||||||||||||||||||||||
2367 | { | - | ||||||||||||||||||||||||
2368 | - | |||||||||||||||||||||||||
2369 | QWindowList list = QGuiApplication::topLevelWindows(); | - | ||||||||||||||||||||||||
2370 | for (int i = 0; i < list.size(); ++i) { | - | ||||||||||||||||||||||||
2371 | QWindow *w = list.at(i); | - | ||||||||||||||||||||||||
2372 | if (processedWindows.contains(w)) | - | ||||||||||||||||||||||||
2373 | continue; | - | ||||||||||||||||||||||||
2374 | if (w->isVisible() && !w->transientParent()) | - | ||||||||||||||||||||||||
2375 | return false; | - | ||||||||||||||||||||||||
2376 | } | - | ||||||||||||||||||||||||
2377 | return true; | - | ||||||||||||||||||||||||
2378 | } | - | ||||||||||||||||||||||||
2379 | - | |||||||||||||||||||||||||
2380 | bool QGuiApplicationPrivate::tryCloseAllWindows() | - | ||||||||||||||||||||||||
2381 | { | - | ||||||||||||||||||||||||
2382 | return tryCloseRemainingWindows(QWindowList()); | - | ||||||||||||||||||||||||
2383 | } | - | ||||||||||||||||||||||||
2384 | - | |||||||||||||||||||||||||
2385 | bool QGuiApplicationPrivate::tryCloseRemainingWindows(QWindowList processedWindows) | - | ||||||||||||||||||||||||
2386 | { | - | ||||||||||||||||||||||||
2387 | QWindowList list = QGuiApplication::topLevelWindows(); | - | ||||||||||||||||||||||||
2388 | for (int i = 0; i < list.size(); ++i) { | - | ||||||||||||||||||||||||
2389 | QWindow *w = list.at(i); | - | ||||||||||||||||||||||||
2390 | if (w->isVisible() && !processedWindows.contains(w)) { | - | ||||||||||||||||||||||||
2391 | if (!w->close()) | - | ||||||||||||||||||||||||
2392 | return false; | - | ||||||||||||||||||||||||
2393 | processedWindows.append(w); | - | ||||||||||||||||||||||||
2394 | list = QGuiApplication::topLevelWindows(); | - | ||||||||||||||||||||||||
2395 | i = -1; | - | ||||||||||||||||||||||||
2396 | } | - | ||||||||||||||||||||||||
2397 | } | - | ||||||||||||||||||||||||
2398 | return true; | - | ||||||||||||||||||||||||
2399 | } | - | ||||||||||||||||||||||||
2400 | Qt::ApplicationState QGuiApplication::applicationState() | - | ||||||||||||||||||||||||
2401 | { | - | ||||||||||||||||||||||||
2402 | return QGuiApplicationPrivate::applicationState; | - | ||||||||||||||||||||||||
2403 | } | - | ||||||||||||||||||||||||
2404 | void QGuiApplicationPrivate::setApplicationState(Qt::ApplicationState state, bool forcePropagate) | - | ||||||||||||||||||||||||
2405 | { | - | ||||||||||||||||||||||||
2406 | if ((applicationState == state) && !forcePropagate) | - | ||||||||||||||||||||||||
2407 | return; | - | ||||||||||||||||||||||||
2408 | - | |||||||||||||||||||||||||
2409 | applicationState = state; | - | ||||||||||||||||||||||||
2410 | - | |||||||||||||||||||||||||
2411 | switch (state) { | - | ||||||||||||||||||||||||
2412 | case Qt::ApplicationActive: { | - | ||||||||||||||||||||||||
2413 | QEvent appActivate(QEvent::ApplicationActivate); | - | ||||||||||||||||||||||||
2414 | QCoreApplication::sendSpontaneousEvent((static_cast<QGuiApplication *>(QCoreApplication::instance())), &appActivate); | - | ||||||||||||||||||||||||
2415 | break; } | - | ||||||||||||||||||||||||
2416 | case Qt::ApplicationInactive: { | - | ||||||||||||||||||||||||
2417 | QEvent appDeactivate(QEvent::ApplicationDeactivate); | - | ||||||||||||||||||||||||
2418 | QCoreApplication::sendSpontaneousEvent((static_cast<QGuiApplication *>(QCoreApplication::instance())), &appDeactivate); | - | ||||||||||||||||||||||||
2419 | break; } | - | ||||||||||||||||||||||||
2420 | default: | - | ||||||||||||||||||||||||
2421 | break; | - | ||||||||||||||||||||||||
2422 | } | - | ||||||||||||||||||||||||
2423 | - | |||||||||||||||||||||||||
2424 | QApplicationStateChangeEvent event(applicationState); | - | ||||||||||||||||||||||||
2425 | QCoreApplication::sendSpontaneousEvent((static_cast<QGuiApplication *>(QCoreApplication::instance())), &event); | - | ||||||||||||||||||||||||
2426 | - | |||||||||||||||||||||||||
2427 | (static_cast<QGuiApplication *>(QCoreApplication::instance()))->applicationStateChanged(applicationState); | - | ||||||||||||||||||||||||
2428 | } | - | ||||||||||||||||||||||||
2429 | bool QGuiApplication::isFallbackSessionManagementEnabled() | - | ||||||||||||||||||||||||
2430 | { | - | ||||||||||||||||||||||||
2431 | return QGuiApplicationPrivate::is_fallback_session_management_enabled; | - | ||||||||||||||||||||||||
2432 | } | - | ||||||||||||||||||||||||
2433 | void QGuiApplication::setFallbackSessionManagementEnabled(bool enabled) | - | ||||||||||||||||||||||||
2434 | { | - | ||||||||||||||||||||||||
2435 | QGuiApplicationPrivate::is_fallback_session_management_enabled = enabled; | - | ||||||||||||||||||||||||
2436 | } | - | ||||||||||||||||||||||||
2437 | bool QGuiApplication::isSessionRestored() const | - | ||||||||||||||||||||||||
2438 | { | - | ||||||||||||||||||||||||
2439 | const QGuiApplicationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2440 | return d->is_session_restored; | - | ||||||||||||||||||||||||
2441 | } | - | ||||||||||||||||||||||||
2442 | - | |||||||||||||||||||||||||
2443 | QString QGuiApplication::sessionId() const | - | ||||||||||||||||||||||||
2444 | { | - | ||||||||||||||||||||||||
2445 | const QGuiApplicationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2446 | return d->session_manager->sessionId(); | - | ||||||||||||||||||||||||
2447 | } | - | ||||||||||||||||||||||||
2448 | - | |||||||||||||||||||||||||
2449 | QString QGuiApplication::sessionKey() const | - | ||||||||||||||||||||||||
2450 | { | - | ||||||||||||||||||||||||
2451 | const QGuiApplicationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2452 | return d->session_manager->sessionKey(); | - | ||||||||||||||||||||||||
2453 | } | - | ||||||||||||||||||||||||
2454 | - | |||||||||||||||||||||||||
2455 | bool QGuiApplication::isSavingSession() const | - | ||||||||||||||||||||||||
2456 | { | - | ||||||||||||||||||||||||
2457 | const QGuiApplicationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2458 | return d->is_saving_session; | - | ||||||||||||||||||||||||
2459 | } | - | ||||||||||||||||||||||||
2460 | - | |||||||||||||||||||||||||
2461 | void QGuiApplicationPrivate::commitData() | - | ||||||||||||||||||||||||
2462 | { | - | ||||||||||||||||||||||||
2463 | QGuiApplication * const q = q_func(); | - | ||||||||||||||||||||||||
2464 | is_saving_session = true; | - | ||||||||||||||||||||||||
2465 | - | |||||||||||||||||||||||||
2466 | q->commitDataRequest(*session_manager); | - | ||||||||||||||||||||||||
2467 | if (is_fallback_session_management_enabled && session_manager->allowsInteraction() | - | ||||||||||||||||||||||||
2468 | && !tryCloseAllWindows()) { | - | ||||||||||||||||||||||||
2469 | session_manager->cancel(); | - | ||||||||||||||||||||||||
2470 | } | - | ||||||||||||||||||||||||
2471 | - | |||||||||||||||||||||||||
2472 | is_saving_session = false; | - | ||||||||||||||||||||||||
2473 | } | - | ||||||||||||||||||||||||
2474 | - | |||||||||||||||||||||||||
2475 | - | |||||||||||||||||||||||||
2476 | void QGuiApplicationPrivate::saveState() | - | ||||||||||||||||||||||||
2477 | { | - | ||||||||||||||||||||||||
2478 | QGuiApplication * const q = q_func(); | - | ||||||||||||||||||||||||
2479 | is_saving_session = true; | - | ||||||||||||||||||||||||
2480 | q->saveStateRequest(*session_manager); | - | ||||||||||||||||||||||||
2481 | is_saving_session = false; | - | ||||||||||||||||||||||||
2482 | } | - | ||||||||||||||||||||||||
2483 | void QGuiApplication::sync() | - | ||||||||||||||||||||||||
2484 | { | - | ||||||||||||||||||||||||
2485 | QCoreApplication::processEvents(); | - | ||||||||||||||||||||||||
2486 | if (QGuiApplicationPrivate::platform_integration | - | ||||||||||||||||||||||||
2487 | && QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::SyncState)) { | - | ||||||||||||||||||||||||
2488 | QGuiApplicationPrivate::platform_integration->sync(); | - | ||||||||||||||||||||||||
2489 | QCoreApplication::processEvents(); | - | ||||||||||||||||||||||||
2490 | QWindowSystemInterface::flushWindowSystemEvents(); | - | ||||||||||||||||||||||||
2491 | } | - | ||||||||||||||||||||||||
2492 | } | - | ||||||||||||||||||||||||
2493 | void QGuiApplication::setLayoutDirection(Qt::LayoutDirection direction) | - | ||||||||||||||||||||||||
2494 | { | - | ||||||||||||||||||||||||
2495 | if (layout_direction == direction || direction == Qt::LayoutDirectionAuto) | - | ||||||||||||||||||||||||
2496 | return; | - | ||||||||||||||||||||||||
2497 | - | |||||||||||||||||||||||||
2498 | layout_direction = direction; | - | ||||||||||||||||||||||||
2499 | - | |||||||||||||||||||||||||
2500 | if ((static_cast<QGuiApplication *>(QCoreApplication::instance()))) { | - | ||||||||||||||||||||||||
2501 | (static_cast<QGuiApplication *>(QCoreApplication::instance()))->layoutDirectionChanged(direction); | - | ||||||||||||||||||||||||
2502 | QGuiApplicationPrivate::self->notifyLayoutDirectionChange(); | - | ||||||||||||||||||||||||
2503 | } | - | ||||||||||||||||||||||||
2504 | } | - | ||||||||||||||||||||||||
2505 | - | |||||||||||||||||||||||||
2506 | Qt::LayoutDirection QGuiApplication::layoutDirection() | - | ||||||||||||||||||||||||
2507 | { | - | ||||||||||||||||||||||||
2508 | - | |||||||||||||||||||||||||
2509 | - | |||||||||||||||||||||||||
2510 | - | |||||||||||||||||||||||||
2511 | return layout_direction == Qt::LayoutDirectionAuto ? Qt::LeftToRight : layout_direction; | - | ||||||||||||||||||||||||
2512 | } | - | ||||||||||||||||||||||||
2513 | QCursor *QGuiApplication::overrideCursor() | - | ||||||||||||||||||||||||
2514 | { | - | ||||||||||||||||||||||||
2515 | if (__builtin_expect(!!(QCoreApplication::instance()), true)) { } else { QMessageLogger(__FILE__, 33803430, __PRETTY_FUNCTION__).warning("Must construct a QGuiApplication first."); return nullptr; } | - | ||||||||||||||||||||||||
2516 | return (static_cast<QGuiApplication *>(QCoreApplication::instance()))->d_func()->cursor_list.isEmpty() ? 0 : &(static_cast<QGuiApplication *>(QCoreApplication::instance()))->d_func()->cursor_list.first(); | - | ||||||||||||||||||||||||
2517 | } | - | ||||||||||||||||||||||||
2518 | void QGuiApplication::changeOverrideCursor(const QCursor &cursor) | - | ||||||||||||||||||||||||
2519 | { | - | ||||||||||||||||||||||||
2520 | if (__builtin_expect(!!(QCoreApplication::instance()), true)) { } else { QMessageLogger(__FILE__, 33943444, __PRETTY_FUNCTION__).warning("Must construct a QGuiApplication first."); return ; } | - | ||||||||||||||||||||||||
2521 | if ((static_cast<QGuiApplication *>(QCoreApplication::instance()))->d_func()->cursor_list.isEmpty()) | - | ||||||||||||||||||||||||
2522 | return; | - | ||||||||||||||||||||||||
2523 | (static_cast<QGuiApplication *>(QCoreApplication::instance()))->d_func()->cursor_list.removeFirst(); | - | ||||||||||||||||||||||||
2524 | setOverrideCursor(cursor); | - | ||||||||||||||||||||||||
2525 | } | - | ||||||||||||||||||||||||
2526 | - | |||||||||||||||||||||||||
2527 | - | |||||||||||||||||||||||||
2528 | - | |||||||||||||||||||||||||
2529 | - | |||||||||||||||||||||||||
2530 | static inline void applyCursor(QWindow *w, QCursor c) | - | ||||||||||||||||||||||||
2531 | { | - | ||||||||||||||||||||||||
2532 | if (const QScreen *screen = w->screen()) | - | ||||||||||||||||||||||||
2533 | if (QPlatformCursor *cursor = screen->handle()->cursor()) | - | ||||||||||||||||||||||||
2534 | cursor->changeCursor(&c, w); | - | ||||||||||||||||||||||||
2535 | } | - | ||||||||||||||||||||||||
2536 | - | |||||||||||||||||||||||||
2537 | static inline void unsetCursor(QWindow *w) | - | ||||||||||||||||||||||||
2538 | { | - | ||||||||||||||||||||||||
2539 | if (const QScreen *screen = w->screen()) | - | ||||||||||||||||||||||||
2540 | if (QPlatformCursor *cursor = screen->handle()->cursor()) | - | ||||||||||||||||||||||||
2541 | cursor->changeCursor(0, w); | - | ||||||||||||||||||||||||
2542 | } | - | ||||||||||||||||||||||||
2543 | - | |||||||||||||||||||||||||
2544 | static inline void applyCursor(const QList<QWindow *> &l, const QCursor &c) | - | ||||||||||||||||||||||||
2545 | { | - | ||||||||||||||||||||||||
2546 | for (int i = 0; i < l.size(); ++i) { | - | ||||||||||||||||||||||||
2547 | QWindow *w = l.at(i); | - | ||||||||||||||||||||||||
2548 | if (w->handle() && w->type() != Qt::Desktop) | - | ||||||||||||||||||||||||
2549 | applyCursor(w, c); | - | ||||||||||||||||||||||||
2550 | } | - | ||||||||||||||||||||||||
2551 | } | - | ||||||||||||||||||||||||
2552 | - | |||||||||||||||||||||||||
2553 | static inline void applyWindowCursor(const QList<QWindow *> &l) | - | ||||||||||||||||||||||||
2554 | { | - | ||||||||||||||||||||||||
2555 | for (int i = 0; i < l.size(); ++i) { | - | ||||||||||||||||||||||||
2556 | QWindow *w = l.at(i); | - | ||||||||||||||||||||||||
2557 | if (w->handle() && w->type() != Qt::Desktop) { | - | ||||||||||||||||||||||||
2558 | if (qt_window_private(w)->hasCursor) { | - | ||||||||||||||||||||||||
2559 | applyCursor(w, w->cursor()); | - | ||||||||||||||||||||||||
2560 | } else { | - | ||||||||||||||||||||||||
2561 | unsetCursor(w); | - | ||||||||||||||||||||||||
2562 | } | - | ||||||||||||||||||||||||
2563 | } | - | ||||||||||||||||||||||||
2564 | } | - | ||||||||||||||||||||||||
2565 | } | - | ||||||||||||||||||||||||
2566 | void QGuiApplication::setOverrideCursor(const QCursor &cursor) | - | ||||||||||||||||||||||||
2567 | { | - | ||||||||||||||||||||||||
2568 | if (__builtin_expect(!!(QCoreApplication::instance()), true)) { } else { QMessageLogger(__FILE__, 34693519, __PRETTY_FUNCTION__).warning("Must construct a QGuiApplication first."); return ; } | - | ||||||||||||||||||||||||
2569 | (static_cast<QGuiApplication *>(QCoreApplication::instance()))->d_func()->cursor_list.prepend(cursor); | - | ||||||||||||||||||||||||
2570 | applyCursor(QGuiApplicationPrivate::window_list, cursor); | - | ||||||||||||||||||||||||
2571 | } | - | ||||||||||||||||||||||||
2572 | void QGuiApplication::restoreOverrideCursor() | - | ||||||||||||||||||||||||
2573 | { | - | ||||||||||||||||||||||||
2574 | if (__builtin_expect(!!(QCoreApplication::instance()), true)) { } else { QMessageLogger(__FILE__, 34873537, __PRETTY_FUNCTION__).warning("Must construct a QGuiApplication first."); return ; } | - | ||||||||||||||||||||||||
2575 | if ((static_cast<QGuiApplication *>(QCoreApplication::instance()))->d_func()->cursor_list.isEmpty()) | - | ||||||||||||||||||||||||
2576 | return; | - | ||||||||||||||||||||||||
2577 | (static_cast<QGuiApplication *>(QCoreApplication::instance()))->d_func()->cursor_list.removeFirst(); | - | ||||||||||||||||||||||||
2578 | if ((static_cast<QGuiApplication *>(QCoreApplication::instance()))->d_func()->cursor_list.size() > 0) { | - | ||||||||||||||||||||||||
2579 | QCursor c((static_cast<QGuiApplication *>(QCoreApplication::instance()))->d_func()->cursor_list.value(0)); | - | ||||||||||||||||||||||||
2580 | applyCursor(QGuiApplicationPrivate::window_list, c); | - | ||||||||||||||||||||||||
2581 | } else { | - | ||||||||||||||||||||||||
2582 | applyWindowCursor(QGuiApplicationPrivate::window_list); | - | ||||||||||||||||||||||||
2583 | } | - | ||||||||||||||||||||||||
2584 | } | - | ||||||||||||||||||||||||
2585 | QStyleHints *QGuiApplication::styleHints() | - | ||||||||||||||||||||||||
2586 | { | - | ||||||||||||||||||||||||
2587 | if (!QGuiApplicationPrivate::styleHints) | - | ||||||||||||||||||||||||
2588 | QGuiApplicationPrivate::styleHints = new QStyleHints(); | - | ||||||||||||||||||||||||
2589 | return QGuiApplicationPrivate::styleHints; | - | ||||||||||||||||||||||||
2590 | } | - | ||||||||||||||||||||||||
2591 | void QGuiApplication::setDesktopSettingsAware(bool on) | - | ||||||||||||||||||||||||
2592 | { | - | ||||||||||||||||||||||||
2593 | QGuiApplicationPrivate::obey_desktop_settings = on; | - | ||||||||||||||||||||||||
2594 | } | - | ||||||||||||||||||||||||
2595 | - | |||||||||||||||||||||||||
2596 | - | |||||||||||||||||||||||||
2597 | - | |||||||||||||||||||||||||
2598 | - | |||||||||||||||||||||||||
2599 | - | |||||||||||||||||||||||||
2600 | - | |||||||||||||||||||||||||
2601 | - | |||||||||||||||||||||||||
2602 | bool QGuiApplication::desktopSettingsAware() | - | ||||||||||||||||||||||||
2603 | { | - | ||||||||||||||||||||||||
2604 | return QGuiApplicationPrivate::obey_desktop_settings; | - | ||||||||||||||||||||||||
2605 | } | - | ||||||||||||||||||||||||
2606 | QInputMethod *QGuiApplication::inputMethod() | - | ||||||||||||||||||||||||
2607 | { | - | ||||||||||||||||||||||||
2608 | if (__builtin_expect(!!(QCoreApplication::instance()), true)) { } else { QMessageLogger(__FILE__, 35553605, __PRETTY_FUNCTION__).warning("Must construct a QGuiApplication first."); return nullptr; } | - | ||||||||||||||||||||||||
2609 | if (!(static_cast<QGuiApplication *>(QCoreApplication::instance()))->d_func()->inputMethod) | - | ||||||||||||||||||||||||
2610 | (static_cast<QGuiApplication *>(QCoreApplication::instance()))->d_func()->inputMethod = new QInputMethod(); | - | ||||||||||||||||||||||||
2611 | return (static_cast<QGuiApplication *>(QCoreApplication::instance()))->d_func()->inputMethod; | - | ||||||||||||||||||||||||
2612 | } | - | ||||||||||||||||||||||||
2613 | QPixmap QGuiApplicationPrivate::getPixmapCursor(Qt::CursorShape cshape) | - | ||||||||||||||||||||||||
2614 | { | - | ||||||||||||||||||||||||
2615 | (void)cshape;; | - | ||||||||||||||||||||||||
2616 | return QPixmap(); | - | ||||||||||||||||||||||||
2617 | } | - | ||||||||||||||||||||||||
2618 | - | |||||||||||||||||||||||||
2619 | void QGuiApplicationPrivate::notifyThemeChanged() | - | ||||||||||||||||||||||||
2620 | { | - | ||||||||||||||||||||||||
2621 | if (!(applicationResourceFlags & ApplicationPaletteExplicitlySet) && | - | ||||||||||||||||||||||||
2622 | !QCoreApplication::testAttribute(Qt::AA_SetPalette)) { | - | ||||||||||||||||||||||||
2623 | clearPalette(); | - | ||||||||||||||||||||||||
2624 | initPalette(); | - | ||||||||||||||||||||||||
2625 | } | - | ||||||||||||||||||||||||
2626 | if (!(applicationResourceFlags & ApplicationFontExplicitlySet)) { | - | ||||||||||||||||||||||||
2627 | QMutexLocker locker(&applicationFontMutex); | - | ||||||||||||||||||||||||
2628 | clearFontUnlocked(); | - | ||||||||||||||||||||||||
2629 | initFontUnlocked(); | - | ||||||||||||||||||||||||
2630 | } | - | ||||||||||||||||||||||||
2631 | } | - | ||||||||||||||||||||||||
2632 | - | |||||||||||||||||||||||||
2633 | - | |||||||||||||||||||||||||
2634 | void QGuiApplicationPrivate::notifyDragStarted(const QDrag *drag) | - | ||||||||||||||||||||||||
2635 | { | - | ||||||||||||||||||||||||
2636 | (void)drag; | - | ||||||||||||||||||||||||
2637 | - | |||||||||||||||||||||||||
2638 | } | - | ||||||||||||||||||||||||
2639 | - | |||||||||||||||||||||||||
2640 | - | |||||||||||||||||||||||||
2641 | const QDrawHelperGammaTables *QGuiApplicationPrivate::gammaTables() | - | ||||||||||||||||||||||||
2642 | { | - | ||||||||||||||||||||||||
2643 | QDrawHelperGammaTables *result = m_gammaTables.load(); | - | ||||||||||||||||||||||||
2644 | if (!result){ | - | ||||||||||||||||||||||||
2645 | QDrawHelperGammaTables *tables = new QDrawHelperGammaTables(fontSmoothingGamma); | - | ||||||||||||||||||||||||
2646 | if (!m_gammaTables.testAndSetRelease(0, tables)) | - | ||||||||||||||||||||||||
2647 | delete tables; | - | ||||||||||||||||||||||||
2648 | result = m_gammaTables.load(); | - | ||||||||||||||||||||||||
2649 | } | - | ||||||||||||||||||||||||
2650 | return result; | - | ||||||||||||||||||||||||
2651 | } | - | ||||||||||||||||||||||||
2652 | - | |||||||||||||||||||||||||
2653 | void QGuiApplicationPrivate::_q_updateFocusObject(QObject *object) | - | ||||||||||||||||||||||||
2654 | { | - | ||||||||||||||||||||||||
2655 | QGuiApplication * const q = q_func(); | - | ||||||||||||||||||||||||
2656 | - | |||||||||||||||||||||||||
2657 | QPlatformInputContext *inputContext = platformIntegration()->inputContext(); | - | ||||||||||||||||||||||||
2658 | bool enabled = false; | - | ||||||||||||||||||||||||
2659 | if (object && inputContext) { | - | ||||||||||||||||||||||||
2660 | QInputMethodQueryEvent query(Qt::ImEnabled | Qt::ImHints); | - | ||||||||||||||||||||||||
2661 | QGuiApplication::sendEvent(object, &query); | - | ||||||||||||||||||||||||
2662 | enabled = query.value(Qt::ImEnabled).toBool(); | - | ||||||||||||||||||||||||
2663 | if (enabled) { | - | ||||||||||||||||||||||||
2664 | static const bool supportsHiddenText = inputContext->hasCapability(QPlatformInputContext::HiddenTextCapability); | - | ||||||||||||||||||||||||
2665 | const Qt::InputMethodHints hints = static_cast<Qt::InputMethodHints>(query.value(Qt::ImHints).toInt()); | - | ||||||||||||||||||||||||
2666 | if ((hints & Qt::ImhHiddenText) && !supportsHiddenText) | - | ||||||||||||||||||||||||
2667 | enabled = false; | - | ||||||||||||||||||||||||
2668 | } | - | ||||||||||||||||||||||||
2669 | } | - | ||||||||||||||||||||||||
2670 | - | |||||||||||||||||||||||||
2671 | QPlatformInputContextPrivate::setInputMethodAccepted(enabled); | - | ||||||||||||||||||||||||
2672 | if (inputContext) | - | ||||||||||||||||||||||||
2673 | inputContext->setFocusObject(object); | - | ||||||||||||||||||||||||
2674 | q->focusObjectChanged(object); | - | ||||||||||||||||||||||||
2675 | } | - | ||||||||||||||||||||||||
2676 | - | |||||||||||||||||||||||||
2677 | enum MouseMasks { | - | ||||||||||||||||||||||||
2678 | MouseCapsMask = 0xFF, | - | ||||||||||||||||||||||||
2679 | MouseSourceMaskDst = 0xFF00, | - | ||||||||||||||||||||||||
2680 | MouseSourceMaskSrc = MouseCapsMask, | - | ||||||||||||||||||||||||
2681 | MouseSourceShift = 8, | - | ||||||||||||||||||||||||
2682 | MouseFlagsCapsMask = 0xFF0000, | - | ||||||||||||||||||||||||
2683 | MouseFlagsShift = 16 | - | ||||||||||||||||||||||||
2684 | }; | - | ||||||||||||||||||||||||
2685 | - | |||||||||||||||||||||||||
2686 | int QGuiApplicationPrivate::mouseEventCaps(QMouseEvent *event) | - | ||||||||||||||||||||||||
2687 | { | - | ||||||||||||||||||||||||
2688 | return event->caps & MouseCapsMask; | - | ||||||||||||||||||||||||
2689 | } | - | ||||||||||||||||||||||||
2690 | - | |||||||||||||||||||||||||
2691 | QVector2D QGuiApplicationPrivate::mouseEventVelocity(QMouseEvent *event) | - | ||||||||||||||||||||||||
2692 | { | - | ||||||||||||||||||||||||
2693 | return event->velocity; | - | ||||||||||||||||||||||||
2694 | } | - | ||||||||||||||||||||||||
2695 | - | |||||||||||||||||||||||||
2696 | void QGuiApplicationPrivate::setMouseEventCapsAndVelocity(QMouseEvent *event, int caps, const QVector2D &velocity) | - | ||||||||||||||||||||||||
2697 | { | - | ||||||||||||||||||||||||
2698 | ((!(caps <= MouseCapsMask)) ? qt_assert("caps <= MouseCapsMask",__FILE__,36573707) : qt_noop()); | - | ||||||||||||||||||||||||
2699 | event->caps &= ~MouseCapsMask; | - | ||||||||||||||||||||||||
2700 | event->caps |= caps & MouseCapsMask; | - | ||||||||||||||||||||||||
2701 | event->velocity = velocity; | - | ||||||||||||||||||||||||
2702 | } | - | ||||||||||||||||||||||||
2703 | - | |||||||||||||||||||||||||
2704 | Qt::MouseEventSource QGuiApplicationPrivate::mouseEventSource(const QMouseEvent *event) | - | ||||||||||||||||||||||||
2705 | { | - | ||||||||||||||||||||||||
2706 | return Qt::MouseEventSource((event->caps & MouseSourceMaskDst) >> MouseSourceShift); | - | ||||||||||||||||||||||||
2707 | } | - | ||||||||||||||||||||||||
2708 | - | |||||||||||||||||||||||||
2709 | void QGuiApplicationPrivate::setMouseEventSource(QMouseEvent *event, Qt::MouseEventSource source) | - | ||||||||||||||||||||||||
2710 | { | - | ||||||||||||||||||||||||
2711 | - | |||||||||||||||||||||||||
2712 | - | |||||||||||||||||||||||||
2713 | int value = source; | - | ||||||||||||||||||||||||
2714 | ((!(value <= MouseSourceMaskSrc)) ? qt_assert("value <= MouseSourceMaskSrc",__FILE__,36733723) : qt_noop()); | - | ||||||||||||||||||||||||
2715 | event->caps &= ~MouseSourceMaskDst; | - | ||||||||||||||||||||||||
2716 | event->caps |= (value & MouseSourceMaskSrc) << MouseSourceShift; | - | ||||||||||||||||||||||||
2717 | } | - | ||||||||||||||||||||||||
2718 | - | |||||||||||||||||||||||||
2719 | Qt::MouseEventFlags QGuiApplicationPrivate::mouseEventFlags(const QMouseEvent *event) | - | ||||||||||||||||||||||||
2720 | { | - | ||||||||||||||||||||||||
2721 | return Qt::MouseEventFlags((event->caps & MouseFlagsCapsMask) >> MouseFlagsShift); | - | ||||||||||||||||||||||||
2722 | } | - | ||||||||||||||||||||||||
2723 | - | |||||||||||||||||||||||||
2724 | void QGuiApplicationPrivate::setMouseEventFlags(QMouseEvent *event, Qt::MouseEventFlags flags) | - | ||||||||||||||||||||||||
2725 | { | - | ||||||||||||||||||||||||
2726 | - | |||||||||||||||||||||||||
2727 | unsigned int value = flags; | - | ||||||||||||||||||||||||
2728 | ((!(value <= Qt::MouseEventFlagMask)) ? qt_assert("value <= Qt::MouseEventFlagMask",__FILE__,36873737) : qt_noop()); | - | ||||||||||||||||||||||||
2729 | event->caps &= ~MouseFlagsCapsMask; | - | ||||||||||||||||||||||||
2730 | event->caps |= (value & Qt::MouseEventFlagMask) << MouseFlagsShift; | - | ||||||||||||||||||||||||
2731 | } | - | ||||||||||||||||||||||||
2732 | - | |||||||||||||||||||||||||
2733 | QInputDeviceManager *QGuiApplicationPrivate::inputDeviceManager() | - | ||||||||||||||||||||||||
2734 | { | - | ||||||||||||||||||||||||
2735 | ((!(QGuiApplication::instance())) ? qt_assert("QGuiApplication::instance()",__FILE__,36943744) : qt_noop()); | - | ||||||||||||||||||||||||
2736 | - | |||||||||||||||||||||||||
2737 | if (!m_inputDeviceManager) | - | ||||||||||||||||||||||||
2738 | m_inputDeviceManager = new QInputDeviceManager(QGuiApplication::instance()); | - | ||||||||||||||||||||||||
2739 | - | |||||||||||||||||||||||||
2740 | return m_inputDeviceManager; | - | ||||||||||||||||||||||||
2741 | } | - | ||||||||||||||||||||||||
2742 | - | |||||||||||||||||||||||||
2743 | - | |||||||||||||||||||||||||
2744 | - | |||||||||||||||||||||||||
Switch to Source code | Preprocessed file |