Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qplatformintegration.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||||||||||||||
2 | ** | - | ||||||||||||||||||
3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||||||||
4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||||||||
5 | ** | - | ||||||||||||||||||
6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||||||||||||||
7 | ** | - | ||||||||||||||||||
8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||||||||
9 | ** Commercial License Usage | - | ||||||||||||||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||
14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||
15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||||||||||||||
16 | ** | - | ||||||||||||||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||
19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||||||||||||||
20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||||||||
21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||||||||
22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||||||||
23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||||||||
24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||||||||
25 | ** | - | ||||||||||||||||||
26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||||||||
27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||||||||
28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||||||||
29 | ** | - | ||||||||||||||||||
30 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||
31 | ** | - | ||||||||||||||||||
32 | ****************************************************************************/ | - | ||||||||||||||||||
33 | - | |||||||||||||||||||
34 | #include "qplatformintegration.h" | - | ||||||||||||||||||
35 | - | |||||||||||||||||||
36 | #include <qpa/qplatformfontdatabase.h> | - | ||||||||||||||||||
37 | #include <qpa/qplatformclipboard.h> | - | ||||||||||||||||||
38 | #include <qpa/qplatformaccessibility.h> | - | ||||||||||||||||||
39 | #include <qpa/qplatformtheme.h> | - | ||||||||||||||||||
40 | #include <QtGui/private/qguiapplication_p.h> | - | ||||||||||||||||||
41 | #include <QtGui/private/qpixmap_raster_p.h> | - | ||||||||||||||||||
42 | #include <private/qdnd_p.h> | - | ||||||||||||||||||
43 | #include <private/qsimpledrag_p.h> | - | ||||||||||||||||||
44 | - | |||||||||||||||||||
45 | #ifndef QT_NO_SESSIONMANAGER | - | ||||||||||||||||||
46 | # include <qpa/qplatformsessionmanager.h> | - | ||||||||||||||||||
47 | #endif | - | ||||||||||||||||||
48 | - | |||||||||||||||||||
49 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||
50 | - | |||||||||||||||||||
51 | /*! | - | ||||||||||||||||||
52 | Accessor for the platform integration's fontdatabase. | - | ||||||||||||||||||
53 | - | |||||||||||||||||||
54 | Default implementation returns a default QPlatformFontDatabase. | - | ||||||||||||||||||
55 | - | |||||||||||||||||||
56 | \sa QPlatformFontDatabase | - | ||||||||||||||||||
57 | */ | - | ||||||||||||||||||
58 | QPlatformFontDatabase *QPlatformIntegration::fontDatabase() const | - | ||||||||||||||||||
59 | { | - | ||||||||||||||||||
60 | static QPlatformFontDatabase *db = 0; | - | ||||||||||||||||||
61 | if (!db) {
| 0 | ||||||||||||||||||
62 | db = new QPlatformFontDatabase; | - | ||||||||||||||||||
63 | } never executed: end of block | 0 | ||||||||||||||||||
64 | return db; never executed: return db; | 0 | ||||||||||||||||||
65 | } | - | ||||||||||||||||||
66 | - | |||||||||||||||||||
67 | /*! | - | ||||||||||||||||||
68 | Accessor for the platform integration's clipboard. | - | ||||||||||||||||||
69 | - | |||||||||||||||||||
70 | Default implementation returns a default QPlatformClipboard. | - | ||||||||||||||||||
71 | - | |||||||||||||||||||
72 | \sa QPlatformClipboard | - | ||||||||||||||||||
73 | - | |||||||||||||||||||
74 | */ | - | ||||||||||||||||||
75 | - | |||||||||||||||||||
76 | #ifndef QT_NO_CLIPBOARD | - | ||||||||||||||||||
77 | - | |||||||||||||||||||
78 | QPlatformClipboard *QPlatformIntegration::clipboard() const | - | ||||||||||||||||||
79 | { | - | ||||||||||||||||||
80 | static QPlatformClipboard *clipboard = 0; | - | ||||||||||||||||||
81 | if (!clipboard) {
| 0 | ||||||||||||||||||
82 | clipboard = new QPlatformClipboard; | - | ||||||||||||||||||
83 | } never executed: end of block | 0 | ||||||||||||||||||
84 | return clipboard; never executed: return clipboard; | 0 | ||||||||||||||||||
85 | } | - | ||||||||||||||||||
86 | - | |||||||||||||||||||
87 | #endif | - | ||||||||||||||||||
88 | - | |||||||||||||||||||
89 | #ifndef QT_NO_DRAGANDDROP | - | ||||||||||||||||||
90 | /*! | - | ||||||||||||||||||
91 | Accessor for the platform integration's drag object. | - | ||||||||||||||||||
92 | - | |||||||||||||||||||
93 | Default implementation returns 0, implying no drag and drop support. | - | ||||||||||||||||||
94 | - | |||||||||||||||||||
95 | */ | - | ||||||||||||||||||
96 | QPlatformDrag *QPlatformIntegration::drag() const | - | ||||||||||||||||||
97 | { | - | ||||||||||||||||||
98 | static QSimpleDrag *drag = 0; | - | ||||||||||||||||||
99 | if (!drag) {
| 0 | ||||||||||||||||||
100 | drag = new QSimpleDrag; | - | ||||||||||||||||||
101 | } never executed: end of block | 0 | ||||||||||||||||||
102 | return drag; never executed: return drag; | 0 | ||||||||||||||||||
103 | } | - | ||||||||||||||||||
104 | #endif | - | ||||||||||||||||||
105 | - | |||||||||||||||||||
106 | QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const | - | ||||||||||||||||||
107 | { | - | ||||||||||||||||||
108 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
109 | } | - | ||||||||||||||||||
110 | - | |||||||||||||||||||
111 | QPlatformServices *QPlatformIntegration::services() const | - | ||||||||||||||||||
112 | { | - | ||||||||||||||||||
113 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
114 | } | - | ||||||||||||||||||
115 | - | |||||||||||||||||||
116 | /*! | - | ||||||||||||||||||
117 | \class QPlatformIntegration | - | ||||||||||||||||||
118 | \since 4.8 | - | ||||||||||||||||||
119 | \internal | - | ||||||||||||||||||
120 | \preliminary | - | ||||||||||||||||||
121 | \ingroup qpa | - | ||||||||||||||||||
122 | \brief The QPlatformIntegration class is the entry for WindowSystem specific functionality. | - | ||||||||||||||||||
123 | - | |||||||||||||||||||
124 | QPlatformIntegration is the single entry point for windowsystem specific functionality when | - | ||||||||||||||||||
125 | using the QPA platform. It has factory functions for creating platform specific pixmaps and | - | ||||||||||||||||||
126 | windows. The class also controls the font subsystem. | - | ||||||||||||||||||
127 | - | |||||||||||||||||||
128 | QPlatformIntegration is a singleton class which gets instantiated in the QGuiApplication | - | ||||||||||||||||||
129 | constructor. The QPlatformIntegration instance do not have ownership of objects it creates in | - | ||||||||||||||||||
130 | functions where the name starts with create. However, functions which don't have a name | - | ||||||||||||||||||
131 | starting with create acts as accessors to member variables. | - | ||||||||||||||||||
132 | - | |||||||||||||||||||
133 | It is not trivial to create or build a platform plugin outside of the Qt source tree. Therefore | - | ||||||||||||||||||
134 | the recommended approach for making new platform plugin is to copy an existing plugin inside | - | ||||||||||||||||||
135 | the QTSRCTREE/src/plugins/platform and develop the plugin inside the source tree. | - | ||||||||||||||||||
136 | - | |||||||||||||||||||
137 | The minimal platform integration is the smallest platform integration it is possible to make, | - | ||||||||||||||||||
138 | which makes it an ideal starting point for new plugins. For a slightly more advanced plugin, | - | ||||||||||||||||||
139 | consider reviewing the directfb plugin, or the testlite plugin. | - | ||||||||||||||||||
140 | */ | - | ||||||||||||||||||
141 | - | |||||||||||||||||||
142 | /*! | - | ||||||||||||||||||
143 | \fn QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const | - | ||||||||||||||||||
144 | - | |||||||||||||||||||
145 | Factory function for QPlatformPixmap. PixelType can be either PixmapType or BitmapType. | - | ||||||||||||||||||
146 | \sa QPlatformPixmap | - | ||||||||||||||||||
147 | */ | - | ||||||||||||||||||
148 | - | |||||||||||||||||||
149 | /*! | - | ||||||||||||||||||
150 | \fn QPlatformWindow *QPlatformIntegration::createPlatformWindow(QWindow *window) const | - | ||||||||||||||||||
151 | - | |||||||||||||||||||
152 | Factory function for QPlatformWindow. The \a window parameter is a pointer to the top level | - | ||||||||||||||||||
153 | window which the QPlatformWindow is supposed to be created for. | - | ||||||||||||||||||
154 | - | |||||||||||||||||||
155 | All top level windows have to have a QPlatformWindow, and it will be created when the | - | ||||||||||||||||||
156 | QPlatformWindow is set to be visible for the first time. If the top level window's flags are | - | ||||||||||||||||||
157 | changed, or if the top level window's QPlatformWindowFormat is changed, then the top level | - | ||||||||||||||||||
158 | window's QPlatformWindow is deleted and a new one is created. | - | ||||||||||||||||||
159 | - | |||||||||||||||||||
160 | In the constructor, of the QPlatformWindow, the window flags, state, title and geometry | - | ||||||||||||||||||
161 | of the \a window should be applied to the underlying window. If the resulting flags or state | - | ||||||||||||||||||
162 | differs, the resulting values should be set on the \a window using QWindow::setWindowFlags() | - | ||||||||||||||||||
163 | or QWindow::setWindowState(), respectively. | - | ||||||||||||||||||
164 | - | |||||||||||||||||||
165 | \sa QPlatformWindow, QPlatformWindowFormat | - | ||||||||||||||||||
166 | \sa createPlatformBackingStore() | - | ||||||||||||||||||
167 | */ | - | ||||||||||||||||||
168 | - | |||||||||||||||||||
169 | /*! | - | ||||||||||||||||||
170 | \fn QPlatformBackingStore *QPlatformIntegration::createPlatformBackingStore(QWindow *window) const | - | ||||||||||||||||||
171 | - | |||||||||||||||||||
172 | Factory function for QPlatformBackingStore. The QWindow parameter is a pointer to the | - | ||||||||||||||||||
173 | top level widget(tlw) the window surface is created for. A QPlatformWindow is always created | - | ||||||||||||||||||
174 | before the QPlatformBackingStore for tlw where the widget also requires a backing store. | - | ||||||||||||||||||
175 | - | |||||||||||||||||||
176 | \sa QBackingStore | - | ||||||||||||||||||
177 | \sa createPlatformWindow() | - | ||||||||||||||||||
178 | */ | - | ||||||||||||||||||
179 | - | |||||||||||||||||||
180 | /*! | - | ||||||||||||||||||
181 | \enum QPlatformIntegration::Capability | - | ||||||||||||||||||
182 | - | |||||||||||||||||||
183 | Capabilities are used to determing specific features of a platform integration | - | ||||||||||||||||||
184 | - | |||||||||||||||||||
185 | \value ThreadedPixmaps The platform uses a pixmap implementation that is reentrant | - | ||||||||||||||||||
186 | and can be used from multiple threads, like the raster paint engine and QImage based | - | ||||||||||||||||||
187 | pixmaps. | - | ||||||||||||||||||
188 | - | |||||||||||||||||||
189 | \value OpenGL The platform supports OpenGL | - | ||||||||||||||||||
190 | - | |||||||||||||||||||
191 | \value ThreadedOpenGL The platform supports using OpenGL outside the GUI thread. | - | ||||||||||||||||||
192 | - | |||||||||||||||||||
193 | \value SharedGraphicsCache The platform supports a shared graphics cache | - | ||||||||||||||||||
194 | - | |||||||||||||||||||
195 | \value BufferQueueingOpenGL The OpenGL implementation on the platform will queue | - | ||||||||||||||||||
196 | up buffers when swapBuffers() is called and block only when its buffer pipeline | - | ||||||||||||||||||
197 | is full, rather than block immediately. | - | ||||||||||||||||||
198 | - | |||||||||||||||||||
199 | \value MultipleWindows The platform supports multiple QWindows, i.e. does some kind | - | ||||||||||||||||||
200 | of compositing either client or server side. Some platforms might only support a | - | ||||||||||||||||||
201 | single fullscreen window. | - | ||||||||||||||||||
202 | - | |||||||||||||||||||
203 | \value ApplicationState The platform handles the application state explicitly. | - | ||||||||||||||||||
204 | This means that QEvent::ApplicationActivate and QEvent::ApplicationDeativate | - | ||||||||||||||||||
205 | will not be posted automatically. Instead, the platform must handle application | - | ||||||||||||||||||
206 | state explicitly by using QWindowSystemInterface::handleApplicationStateChanged(). | - | ||||||||||||||||||
207 | If not set, application state will follow window activation, which is the normal | - | ||||||||||||||||||
208 | behavior for desktop platforms. | - | ||||||||||||||||||
209 | - | |||||||||||||||||||
210 | \value ForeignWindows The platform allows creating QWindows which represent | - | ||||||||||||||||||
211 | native windows created by other processes or by using native libraries. | - | ||||||||||||||||||
212 | - | |||||||||||||||||||
213 | \value NonFullScreenWindows The platform supports top-level windows which do not | - | ||||||||||||||||||
214 | fill the screen. The default implementation returns \c true. Returning false for | - | ||||||||||||||||||
215 | this will cause all windows, including dialogs and popups, to be resized to fill the | - | ||||||||||||||||||
216 | screen. | - | ||||||||||||||||||
217 | - | |||||||||||||||||||
218 | \value WindowManagement The platform is based on a system that performs window | - | ||||||||||||||||||
219 | management. This includes the typical desktop platforms. Can be set to false on | - | ||||||||||||||||||
220 | platforms where no window management is available, meaning for example that windows | - | ||||||||||||||||||
221 | are never repositioned by the window manager. The default implementation returns \c true. | - | ||||||||||||||||||
222 | - | |||||||||||||||||||
223 | \value AllGLFunctionsQueryable The QOpenGLContext backend provided by the platform is | - | ||||||||||||||||||
224 | able to return function pointers from getProcAddress() even for standard OpenGL | - | ||||||||||||||||||
225 | functions, for example OpenGL 1 functions like glClear() or glDrawArrays(). This is | - | ||||||||||||||||||
226 | important because the OpenGL specifications do not require this ability from the | - | ||||||||||||||||||
227 | getProcAddress implementations of the windowing system interfaces (EGL, WGL, GLX). The | - | ||||||||||||||||||
228 | platform plugins may however choose to enhance the behavior in the backend | - | ||||||||||||||||||
229 | implementation for QOpenGLContext::getProcAddress() and support returning a function | - | ||||||||||||||||||
230 | pointer also for the standard, non-extension functions. This capability is a | - | ||||||||||||||||||
231 | prerequisite for dynamic OpenGL loading. | - | ||||||||||||||||||
232 | - | |||||||||||||||||||
233 | \value ApplicationIcon The platform supports setting the application icon. (since 5.5) | - | ||||||||||||||||||
234 | */ | - | ||||||||||||||||||
235 | - | |||||||||||||||||||
236 | /*! | - | ||||||||||||||||||
237 | - | |||||||||||||||||||
238 | \fn QAbstractEventDispatcher *QPlatformIntegration::createEventDispatcher() const = 0 | - | ||||||||||||||||||
239 | - | |||||||||||||||||||
240 | Factory function for the GUI event dispatcher. The platform plugin should create | - | ||||||||||||||||||
241 | and return a QAbstractEventDispatcher subclass when this function is called. | - | ||||||||||||||||||
242 | - | |||||||||||||||||||
243 | If the platform plugin for some reason creates the event dispatcher outside of | - | ||||||||||||||||||
244 | this function (for example in the constructor), it needs to handle the case | - | ||||||||||||||||||
245 | where this function is never called, ensuring that the event dispatcher is | - | ||||||||||||||||||
246 | still deleted at some point (typically in the destructor). | - | ||||||||||||||||||
247 | - | |||||||||||||||||||
248 | Note that the platform plugin should never explicitly set the event dispatcher | - | ||||||||||||||||||
249 | itself, using QCoreApplication::setEventDispatcher(), but let QCoreApplication | - | ||||||||||||||||||
250 | decide when and which event dispatcher to create. | - | ||||||||||||||||||
251 | - | |||||||||||||||||||
252 | \since 5.2 | - | ||||||||||||||||||
253 | */ | - | ||||||||||||||||||
254 | - | |||||||||||||||||||
255 | bool QPlatformIntegration::hasCapability(Capability cap) const | - | ||||||||||||||||||
256 | { | - | ||||||||||||||||||
257 | return cap == NonFullScreenWindows || cap == NativeWidgets || cap == WindowManagement; never executed: return cap == NonFullScreenWindows || cap == NativeWidgets || cap == WindowManagement;
| 0 | ||||||||||||||||||
258 | } | - | ||||||||||||||||||
259 | - | |||||||||||||||||||
260 | QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const | - | ||||||||||||||||||
261 | { | - | ||||||||||||||||||
262 | return new QRasterPlatformPixmap(type); never executed: return new QRasterPlatformPixmap(type); | 0 | ||||||||||||||||||
263 | } | - | ||||||||||||||||||
264 | - | |||||||||||||||||||
265 | #ifndef QT_NO_OPENGL | - | ||||||||||||||||||
266 | /*! | - | ||||||||||||||||||
267 | Factory function for QPlatformOpenGLContext. The \a context parameter is a pointer to | - | ||||||||||||||||||
268 | the context for which a platform-specific context backend needs to be | - | ||||||||||||||||||
269 | created. Configuration settings like the format, share context and screen have to be | - | ||||||||||||||||||
270 | taken from this QOpenGLContext and the resulting platform context is expected to be | - | ||||||||||||||||||
271 | backed by a native context that fulfills these criteria. | - | ||||||||||||||||||
272 | - | |||||||||||||||||||
273 | If the context has native handles set, no new native context is expected to be created. | - | ||||||||||||||||||
274 | Instead, the provided handles have to be used. In this case the ownership of the handle | - | ||||||||||||||||||
275 | must not be taken and the platform implementation is not allowed to destroy the native | - | ||||||||||||||||||
276 | context. Configuration parameters like the format are also to be ignored. Instead, the | - | ||||||||||||||||||
277 | platform implementation is responsible for querying the configuriation from the provided | - | ||||||||||||||||||
278 | native context. | - | ||||||||||||||||||
279 | - | |||||||||||||||||||
280 | Returns a pointer to a QPlatformOpenGLContext instance or \c NULL if the context could | - | ||||||||||||||||||
281 | not be created. | - | ||||||||||||||||||
282 | - | |||||||||||||||||||
283 | \sa QOpenGLContext | - | ||||||||||||||||||
284 | */ | - | ||||||||||||||||||
285 | QPlatformOpenGLContext *QPlatformIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const | - | ||||||||||||||||||
286 | { | - | ||||||||||||||||||
287 | Q_UNUSED(context); | - | ||||||||||||||||||
288 | qWarning("This plugin does not support createPlatformOpenGLContext!"); | - | ||||||||||||||||||
289 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
290 | } | - | ||||||||||||||||||
291 | #endif // QT_NO_OPENGL | - | ||||||||||||||||||
292 | - | |||||||||||||||||||
293 | /*! | - | ||||||||||||||||||
294 | Factory function for QPlatformSharedGraphicsCache. This function will return 0 if the platform | - | ||||||||||||||||||
295 | integration does not support any shared graphics cache mechanism for the given \a cacheId. | - | ||||||||||||||||||
296 | */ | - | ||||||||||||||||||
297 | QPlatformSharedGraphicsCache *QPlatformIntegration::createPlatformSharedGraphicsCache(const char *cacheId) const | - | ||||||||||||||||||
298 | { | - | ||||||||||||||||||
299 | qWarning("This plugin does not support createPlatformSharedGraphicsBuffer for cacheId: %s!", | - | ||||||||||||||||||
300 | cacheId); | - | ||||||||||||||||||
301 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
302 | } | - | ||||||||||||||||||
303 | - | |||||||||||||||||||
304 | /*! | - | ||||||||||||||||||
305 | Factory function for QPaintEngine. This function will return 0 if the platform | - | ||||||||||||||||||
306 | integration does not support creating any paint engine the given \a paintDevice. | - | ||||||||||||||||||
307 | */ | - | ||||||||||||||||||
308 | QPaintEngine *QPlatformIntegration::createImagePaintEngine(QPaintDevice *paintDevice) const | - | ||||||||||||||||||
309 | { | - | ||||||||||||||||||
310 | Q_UNUSED(paintDevice) | - | ||||||||||||||||||
311 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
312 | } | - | ||||||||||||||||||
313 | - | |||||||||||||||||||
314 | /*! | - | ||||||||||||||||||
315 | Performs initialization steps that depend on having an event dispatcher | - | ||||||||||||||||||
316 | available. Called after the event dispatcher has been created. | - | ||||||||||||||||||
317 | - | |||||||||||||||||||
318 | Tasks that require an event dispatcher, for example creating socket notifiers, cannot be | - | ||||||||||||||||||
319 | performed in the constructor. Instead, they should be performed here. The default | - | ||||||||||||||||||
320 | implementation does nothing. | - | ||||||||||||||||||
321 | */ | - | ||||||||||||||||||
322 | void QPlatformIntegration::initialize() | - | ||||||||||||||||||
323 | { | - | ||||||||||||||||||
324 | } | - | ||||||||||||||||||
325 | - | |||||||||||||||||||
326 | /*! | - | ||||||||||||||||||
327 | Called before the platform integration is deleted. Useful when cleanup relies on virtual | - | ||||||||||||||||||
328 | functions. | - | ||||||||||||||||||
329 | - | |||||||||||||||||||
330 | \since 5.5 | - | ||||||||||||||||||
331 | */ | - | ||||||||||||||||||
332 | void QPlatformIntegration::destroy() | - | ||||||||||||||||||
333 | { | - | ||||||||||||||||||
334 | } | - | ||||||||||||||||||
335 | - | |||||||||||||||||||
336 | /*! | - | ||||||||||||||||||
337 | Returns the platforms input context. | - | ||||||||||||||||||
338 | - | |||||||||||||||||||
339 | The default implementation returns 0, implying no input method support. | - | ||||||||||||||||||
340 | */ | - | ||||||||||||||||||
341 | QPlatformInputContext *QPlatformIntegration::inputContext() const | - | ||||||||||||||||||
342 | { | - | ||||||||||||||||||
343 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
344 | } | - | ||||||||||||||||||
345 | - | |||||||||||||||||||
346 | #ifndef QT_NO_ACCESSIBILITY | - | ||||||||||||||||||
347 | - | |||||||||||||||||||
348 | /*! | - | ||||||||||||||||||
349 | Returns the platforms accessibility. | - | ||||||||||||||||||
350 | - | |||||||||||||||||||
351 | The default implementation returns 0, implying no accessibility support. | - | ||||||||||||||||||
352 | */ | - | ||||||||||||||||||
353 | QPlatformAccessibility *QPlatformIntegration::accessibility() const | - | ||||||||||||||||||
354 | { | - | ||||||||||||||||||
355 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
356 | } | - | ||||||||||||||||||
357 | - | |||||||||||||||||||
358 | #endif | - | ||||||||||||||||||
359 | - | |||||||||||||||||||
360 | QVariant QPlatformIntegration::styleHint(StyleHint hint) const | - | ||||||||||||||||||
361 | { | - | ||||||||||||||||||
362 | switch (hint) { | - | ||||||||||||||||||
363 | case CursorFlashTime: never executed: case CursorFlashTime: | 0 | ||||||||||||||||||
364 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::CursorFlashTime); never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::CursorFlashTime); | 0 | ||||||||||||||||||
365 | case KeyboardInputInterval: never executed: case KeyboardInputInterval: | 0 | ||||||||||||||||||
366 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::KeyboardInputInterval); never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::KeyboardInputInterval); | 0 | ||||||||||||||||||
367 | case KeyboardAutoRepeatRate: never executed: case KeyboardAutoRepeatRate: | 0 | ||||||||||||||||||
368 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::KeyboardAutoRepeatRate); never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::KeyboardAutoRepeatRate); | 0 | ||||||||||||||||||
369 | case MouseDoubleClickInterval: never executed: case MouseDoubleClickInterval: | 0 | ||||||||||||||||||
370 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::MouseDoubleClickInterval); never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::MouseDoubleClickInterval); | 0 | ||||||||||||||||||
371 | case StartDragDistance: never executed: case StartDragDistance: | 0 | ||||||||||||||||||
372 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragDistance); never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragDistance); | 0 | ||||||||||||||||||
373 | case StartDragTime: never executed: case StartDragTime: | 0 | ||||||||||||||||||
374 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragTime); never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragTime); | 0 | ||||||||||||||||||
375 | case ShowIsFullScreen: never executed: case ShowIsFullScreen: | 0 | ||||||||||||||||||
376 | return false; never executed: return false; | 0 | ||||||||||||||||||
377 | case ShowIsMaximized: never executed: case ShowIsMaximized: | 0 | ||||||||||||||||||
378 | return false; never executed: return false; | 0 | ||||||||||||||||||
379 | case PasswordMaskDelay: never executed: case PasswordMaskDelay: | 0 | ||||||||||||||||||
380 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::PasswordMaskDelay); never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::PasswordMaskDelay); | 0 | ||||||||||||||||||
381 | case PasswordMaskCharacter: never executed: case PasswordMaskCharacter: | 0 | ||||||||||||||||||
382 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::PasswordMaskCharacter); never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::PasswordMaskCharacter); | 0 | ||||||||||||||||||
383 | case FontSmoothingGamma: never executed: case FontSmoothingGamma: | 0 | ||||||||||||||||||
384 | return qreal(1.7); never executed: return qreal(1.7); | 0 | ||||||||||||||||||
385 | case StartDragVelocity: never executed: case StartDragVelocity: | 0 | ||||||||||||||||||
386 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragVelocity); never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragVelocity); | 0 | ||||||||||||||||||
387 | case UseRtlExtensions: never executed: case UseRtlExtensions: | 0 | ||||||||||||||||||
388 | return QVariant(false); never executed: return QVariant(false); | 0 | ||||||||||||||||||
389 | case SetFocusOnTouchRelease: never executed: case SetFocusOnTouchRelease: | 0 | ||||||||||||||||||
390 | return QVariant(false); never executed: return QVariant(false); | 0 | ||||||||||||||||||
391 | case MousePressAndHoldInterval: never executed: case MousePressAndHoldInterval: | 0 | ||||||||||||||||||
392 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::MousePressAndHoldInterval); never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::MousePressAndHoldInterval); | 0 | ||||||||||||||||||
393 | case TabFocusBehavior: never executed: case TabFocusBehavior: | 0 | ||||||||||||||||||
394 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::TabFocusBehavior); never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::TabFocusBehavior); | 0 | ||||||||||||||||||
395 | case ReplayMousePressOutsidePopup: never executed: case ReplayMousePressOutsidePopup: | 0 | ||||||||||||||||||
396 | return true; never executed: return true; | 0 | ||||||||||||||||||
397 | case ItemViewActivateItemOnSingleClick: never executed: case ItemViewActivateItemOnSingleClick: | 0 | ||||||||||||||||||
398 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::ItemViewActivateItemOnSingleClick); never executed: return QPlatformTheme::defaultThemeHint(QPlatformTheme::ItemViewActivateItemOnSingleClick); | 0 | ||||||||||||||||||
399 | } | - | ||||||||||||||||||
400 | - | |||||||||||||||||||
401 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
402 | } | - | ||||||||||||||||||
403 | - | |||||||||||||||||||
404 | Qt::WindowState QPlatformIntegration::defaultWindowState(Qt::WindowFlags flags) const | - | ||||||||||||||||||
405 | { | - | ||||||||||||||||||
406 | // Leave popup-windows as is | - | ||||||||||||||||||
407 | if (flags & Qt::Popup & ~Qt::Window)
| 0 | ||||||||||||||||||
408 | return Qt::WindowNoState; never executed: return Qt::WindowNoState; | 0 | ||||||||||||||||||
409 | - | |||||||||||||||||||
410 | if (styleHint(QPlatformIntegration::ShowIsFullScreen).toBool())
| 0 | ||||||||||||||||||
411 | return Qt::WindowFullScreen; never executed: return Qt::WindowFullScreen; | 0 | ||||||||||||||||||
412 | else if (styleHint(QPlatformIntegration::ShowIsMaximized).toBool())
| 0 | ||||||||||||||||||
413 | return Qt::WindowMaximized; never executed: return Qt::WindowMaximized; | 0 | ||||||||||||||||||
414 | - | |||||||||||||||||||
415 | return Qt::WindowNoState; never executed: return Qt::WindowNoState; | 0 | ||||||||||||||||||
416 | } | - | ||||||||||||||||||
417 | - | |||||||||||||||||||
418 | Qt::KeyboardModifiers QPlatformIntegration::queryKeyboardModifiers() const | - | ||||||||||||||||||
419 | { | - | ||||||||||||||||||
420 | return QGuiApplication::keyboardModifiers(); never executed: return QGuiApplication::keyboardModifiers(); | 0 | ||||||||||||||||||
421 | } | - | ||||||||||||||||||
422 | - | |||||||||||||||||||
423 | /*! | - | ||||||||||||||||||
424 | Should be used to obtain a list of possible shortcuts for the given key | - | ||||||||||||||||||
425 | event. As that needs system functionality it cannot be done in qkeymapper. | - | ||||||||||||||||||
426 | - | |||||||||||||||||||
427 | One example for more than 1 possibility is the key combination of Shift+5. | - | ||||||||||||||||||
428 | That one might trigger a shortcut which is set as "Shift+5" as well as one | - | ||||||||||||||||||
429 | using %. These combinations depend on the currently set keyboard layout | - | ||||||||||||||||||
430 | which cannot be obtained by Qt functionality. | - | ||||||||||||||||||
431 | */ | - | ||||||||||||||||||
432 | QList<int> QPlatformIntegration::possibleKeys(const QKeyEvent *) const | - | ||||||||||||||||||
433 | { | - | ||||||||||||||||||
434 | return QList<int>(); never executed: return QList<int>(); | 0 | ||||||||||||||||||
435 | } | - | ||||||||||||||||||
436 | - | |||||||||||||||||||
437 | /*! | - | ||||||||||||||||||
438 | Should be called by the implementation whenever a new screen is added. | - | ||||||||||||||||||
439 | - | |||||||||||||||||||
440 | The first screen added will be the primary screen, used for default-created | - | ||||||||||||||||||
441 | windows, GL contexts, and other resources unless otherwise specified. | - | ||||||||||||||||||
442 | - | |||||||||||||||||||
443 | This adds the screen to QGuiApplication::screens(), and emits the | - | ||||||||||||||||||
444 | QGuiApplication::screenAdded() signal. | - | ||||||||||||||||||
445 | - | |||||||||||||||||||
446 | The screen should be deleted by calling QPlatformIntegration::destroyScreen(). | - | ||||||||||||||||||
447 | */ | - | ||||||||||||||||||
448 | void QPlatformIntegration::screenAdded(QPlatformScreen *ps, bool isPrimary) | - | ||||||||||||||||||
449 | { | - | ||||||||||||||||||
450 | QScreen *screen = new QScreen(ps); | - | ||||||||||||||||||
451 | - | |||||||||||||||||||
452 | if (isPrimary) {
| 0 | ||||||||||||||||||
453 | QGuiApplicationPrivate::screen_list.prepend(screen); | - | ||||||||||||||||||
454 | } else { never executed: end of block | 0 | ||||||||||||||||||
455 | QGuiApplicationPrivate::screen_list.append(screen); | - | ||||||||||||||||||
456 | } never executed: end of block | 0 | ||||||||||||||||||
457 | emit qGuiApp->screenAdded(screen); | - | ||||||||||||||||||
458 | - | |||||||||||||||||||
459 | if (isPrimary)
| 0 | ||||||||||||||||||
460 | emit qGuiApp->primaryScreenChanged(screen); never executed: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->primaryScreenChanged(screen); | 0 | ||||||||||||||||||
461 | } never executed: end of block | 0 | ||||||||||||||||||
462 | - | |||||||||||||||||||
463 | /*! | - | ||||||||||||||||||
464 | Just removes the screen, call destroyScreen instead. | - | ||||||||||||||||||
465 | - | |||||||||||||||||||
466 | \sa destroyScreen() | - | ||||||||||||||||||
467 | */ | - | ||||||||||||||||||
468 | - | |||||||||||||||||||
469 | void QPlatformIntegration::removeScreen(QScreen *screen) | - | ||||||||||||||||||
470 | { | - | ||||||||||||||||||
471 | const bool wasPrimary = (!QGuiApplicationPrivate::screen_list.isEmpty() && QGuiApplicationPrivate::screen_list[0] == screen);
| 0 | ||||||||||||||||||
472 | QGuiApplicationPrivate::screen_list.removeOne(screen); | - | ||||||||||||||||||
473 | - | |||||||||||||||||||
474 | if (wasPrimary && qGuiApp && !QGuiApplicationPrivate::screen_list.isEmpty())
| 0 | ||||||||||||||||||
475 | emit qGuiApp->primaryScreenChanged(QGuiApplicationPrivate::screen_list[0]); never executed: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->primaryScreenChanged(QGuiApplicationPrivate::screen_list[0]); | 0 | ||||||||||||||||||
476 | } never executed: end of block | 0 | ||||||||||||||||||
477 | - | |||||||||||||||||||
478 | /*! | - | ||||||||||||||||||
479 | Should be called by the implementation whenever a screen is removed. | - | ||||||||||||||||||
480 | - | |||||||||||||||||||
481 | This removes the screen from QGuiApplication::screens(), and deletes it. | - | ||||||||||||||||||
482 | - | |||||||||||||||||||
483 | Failing to call this and manually deleting the QPlatformScreen instead may | - | ||||||||||||||||||
484 | lead to a crash due to a pure virtual call. | - | ||||||||||||||||||
485 | */ | - | ||||||||||||||||||
486 | void QPlatformIntegration::destroyScreen(QPlatformScreen *screen) | - | ||||||||||||||||||
487 | { | - | ||||||||||||||||||
488 | QScreen *qScreen = screen->screen(); | - | ||||||||||||||||||
489 | removeScreen(qScreen); | - | ||||||||||||||||||
490 | delete qScreen; | - | ||||||||||||||||||
491 | delete screen; | - | ||||||||||||||||||
492 | } never executed: end of block | 0 | ||||||||||||||||||
493 | - | |||||||||||||||||||
494 | /*! | - | ||||||||||||||||||
495 | Should be called whenever the primary screen changes. | - | ||||||||||||||||||
496 | - | |||||||||||||||||||
497 | When the screen specified as primary changes, this method will notify | - | ||||||||||||||||||
498 | QGuiApplication and emit the QGuiApplication::primaryScreenChanged signal. | - | ||||||||||||||||||
499 | */ | - | ||||||||||||||||||
500 | - | |||||||||||||||||||
501 | void QPlatformIntegration::setPrimaryScreen(QPlatformScreen *newPrimary) | - | ||||||||||||||||||
502 | { | - | ||||||||||||||||||
503 | QScreen* newPrimaryScreen = newPrimary->screen(); | - | ||||||||||||||||||
504 | int idx = QGuiApplicationPrivate::screen_list.indexOf(newPrimaryScreen); | - | ||||||||||||||||||
505 | Q_ASSERT(idx >= 0); | - | ||||||||||||||||||
506 | if (idx == 0)
| 0 | ||||||||||||||||||
507 | return; never executed: return; | 0 | ||||||||||||||||||
508 | - | |||||||||||||||||||
509 | QGuiApplicationPrivate::screen_list.swap(0, idx); | - | ||||||||||||||||||
510 | emit qGuiApp->primaryScreenChanged(newPrimaryScreen); | - | ||||||||||||||||||
511 | } never executed: end of block | 0 | ||||||||||||||||||
512 | - | |||||||||||||||||||
513 | QStringList QPlatformIntegration::themeNames() const | - | ||||||||||||||||||
514 | { | - | ||||||||||||||||||
515 | return QStringList(); never executed: return QStringList(); | 0 | ||||||||||||||||||
516 | } | - | ||||||||||||||||||
517 | - | |||||||||||||||||||
518 | class QPlatformTheme *QPlatformIntegration::createPlatformTheme(const QString &name) const | - | ||||||||||||||||||
519 | { | - | ||||||||||||||||||
520 | Q_UNUSED(name) | - | ||||||||||||||||||
521 | return new QPlatformTheme; never executed: return new QPlatformTheme; | 0 | ||||||||||||||||||
522 | } | - | ||||||||||||||||||
523 | - | |||||||||||||||||||
524 | /*! | - | ||||||||||||||||||
525 | Factory function for QOffscreenSurface. An offscreen surface will typically be implemented with a | - | ||||||||||||||||||
526 | pixel buffer (pbuffer). If the platform doesn't support offscreen surfaces, an invisible window | - | ||||||||||||||||||
527 | will be used by QOffscreenSurface instead. | - | ||||||||||||||||||
528 | */ | - | ||||||||||||||||||
529 | QPlatformOffscreenSurface *QPlatformIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const | - | ||||||||||||||||||
530 | { | - | ||||||||||||||||||
531 | Q_UNUSED(surface) | - | ||||||||||||||||||
532 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
533 | } | - | ||||||||||||||||||
534 | - | |||||||||||||||||||
535 | #ifndef QT_NO_SESSIONMANAGER | - | ||||||||||||||||||
536 | /*! | - | ||||||||||||||||||
537 | \since 5.2 | - | ||||||||||||||||||
538 | - | |||||||||||||||||||
539 | Factory function for QPlatformSessionManager. The default QPlatformSessionManager provides the same | - | ||||||||||||||||||
540 | functionality as the QSessionManager. | - | ||||||||||||||||||
541 | */ | - | ||||||||||||||||||
542 | QPlatformSessionManager *QPlatformIntegration::createPlatformSessionManager(const QString &id, const QString &key) const | - | ||||||||||||||||||
543 | { | - | ||||||||||||||||||
544 | return new QPlatformSessionManager(id, key); never executed: return new QPlatformSessionManager(id, key); | 0 | ||||||||||||||||||
545 | } | - | ||||||||||||||||||
546 | #endif | - | ||||||||||||||||||
547 | - | |||||||||||||||||||
548 | /*! | - | ||||||||||||||||||
549 | \since 5.2 | - | ||||||||||||||||||
550 | - | |||||||||||||||||||
551 | Function to sync the platform integrations state with the window system. | - | ||||||||||||||||||
552 | - | |||||||||||||||||||
553 | This is often implemented as a roundtrip from the platformintegration to the window system. | - | ||||||||||||||||||
554 | - | |||||||||||||||||||
555 | This function should not call QWindowSystemInterface::flushWindowSystemEvents() or | - | ||||||||||||||||||
556 | QCoreApplication::processEvents() | - | ||||||||||||||||||
557 | */ | - | ||||||||||||||||||
558 | void QPlatformIntegration::sync() | - | ||||||||||||||||||
559 | { | - | ||||||||||||||||||
560 | } | - | ||||||||||||||||||
561 | - | |||||||||||||||||||
562 | #ifndef QT_NO_OPENGL | - | ||||||||||||||||||
563 | /*! | - | ||||||||||||||||||
564 | Platform integration function for querying the OpenGL implementation type. | - | ||||||||||||||||||
565 | - | |||||||||||||||||||
566 | Used only when dynamic OpenGL implementation loading is enabled. | - | ||||||||||||||||||
567 | - | |||||||||||||||||||
568 | Subclasses should reimplement this function and return a value based on | - | ||||||||||||||||||
569 | the OpenGL implementation they have chosen to load. | - | ||||||||||||||||||
570 | - | |||||||||||||||||||
571 | \note The return value does not indicate or limit the types of | - | ||||||||||||||||||
572 | contexts that can be created by a given implementation. For example | - | ||||||||||||||||||
573 | a desktop OpenGL implementation may be capable of creating OpenGL | - | ||||||||||||||||||
574 | ES-compatible contexts too. | - | ||||||||||||||||||
575 | - | |||||||||||||||||||
576 | \sa QOpenGLContext::openGLModuleType(), QOpenGLContext::isOpenGLES() | - | ||||||||||||||||||
577 | - | |||||||||||||||||||
578 | \since 5.3 | - | ||||||||||||||||||
579 | */ | - | ||||||||||||||||||
580 | QOpenGLContext::OpenGLModuleType QPlatformIntegration::openGLModuleType() | - | ||||||||||||||||||
581 | { | - | ||||||||||||||||||
582 | qWarning("This plugin does not support dynamic OpenGL loading!"); | - | ||||||||||||||||||
583 | return QOpenGLContext::LibGL; never executed: return QOpenGLContext::LibGL; | 0 | ||||||||||||||||||
584 | } | - | ||||||||||||||||||
585 | #endif | - | ||||||||||||||||||
586 | - | |||||||||||||||||||
587 | /*! | - | ||||||||||||||||||
588 | \since 5.5 | - | ||||||||||||||||||
589 | - | |||||||||||||||||||
590 | Platform integration function for setting the application icon. | - | ||||||||||||||||||
591 | - | |||||||||||||||||||
592 | \sa QGuiApplication::setWindowIcon() | - | ||||||||||||||||||
593 | */ | - | ||||||||||||||||||
594 | void QPlatformIntegration::setApplicationIcon(const QIcon &icon) const | - | ||||||||||||||||||
595 | { | - | ||||||||||||||||||
596 | Q_UNUSED(icon); | - | ||||||||||||||||||
597 | } never executed: end of block | 0 | ||||||||||||||||||
598 | - | |||||||||||||||||||
599 | QT_END_NAMESPACE | - | ||||||||||||||||||
Source code | Switch to Preprocessed file |