/src/qtbase/src/gui/kernel/qplatformintegration.cpp
Line | Count | Source |
1 | | // Copyright (C) 2016 The Qt Company Ltd. |
2 | | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | | |
4 | | #include "qplatformintegration.h" |
5 | | |
6 | | #include <qpa/qplatformfontdatabase.h> |
7 | | #include <qpa/qplatformclipboard.h> |
8 | | #include <qpa/qplatformaccessibility.h> |
9 | | #include <qpa/qplatformkeymapper.h> |
10 | | #include <qpa/qplatformtheme.h> |
11 | | #include <QtGui/private/qguiapplication_p.h> |
12 | | #include <QtGui/private/qpixmap_raster_p.h> |
13 | | |
14 | | #if QT_CONFIG(draganddrop) |
15 | | #include <private/qdnd_p.h> |
16 | | #include <private/qsimpledrag_p.h> |
17 | | #endif |
18 | | |
19 | | #ifndef QT_NO_SESSIONMANAGER |
20 | | # include <qpa/qplatformsessionmanager.h> |
21 | | #endif |
22 | | |
23 | | QT_BEGIN_NAMESPACE |
24 | | |
25 | | /*! |
26 | | Accessor for the platform integration's fontdatabase. |
27 | | |
28 | | Default implementation returns a default QPlatformFontDatabase. |
29 | | |
30 | | \sa QPlatformFontDatabase |
31 | | */ |
32 | | QPlatformFontDatabase *QPlatformIntegration::fontDatabase() const |
33 | 0 | { |
34 | 0 | static QPlatformFontDatabase *db = nullptr; |
35 | 0 | if (!db) { |
36 | 0 | db = new QPlatformFontDatabase; |
37 | 0 | } |
38 | 0 | return db; |
39 | 0 | } |
40 | | |
41 | | /*! |
42 | | Accessor for the platform integration's clipboard. |
43 | | |
44 | | Default implementation returns a default QPlatformClipboard. |
45 | | |
46 | | \sa QPlatformClipboard |
47 | | |
48 | | */ |
49 | | |
50 | | #ifndef QT_NO_CLIPBOARD |
51 | | |
52 | | QPlatformClipboard *QPlatformIntegration::clipboard() const |
53 | 0 | { |
54 | 0 | static QPlatformClipboard *clipboard = nullptr; |
55 | 0 | if (!clipboard) { |
56 | 0 | clipboard = new QPlatformClipboard; |
57 | 0 | } |
58 | 0 | return clipboard; |
59 | 0 | } |
60 | | |
61 | | #endif |
62 | | |
63 | | #if QT_CONFIG(draganddrop) |
64 | | /*! |
65 | | Accessor for the platform integration's drag object. |
66 | | |
67 | | Default implementation returns QSimpleDrag. This class supports only drag |
68 | | and drop operations within the same Qt application. |
69 | | */ |
70 | | QPlatformDrag *QPlatformIntegration::drag() const |
71 | 0 | { |
72 | 0 | static QSimpleDrag *drag = nullptr; |
73 | 0 | if (!drag) { |
74 | 0 | drag = new QSimpleDrag; |
75 | 0 | } |
76 | 0 | return drag; |
77 | 0 | } |
78 | | #endif // QT_CONFIG(draganddrop) |
79 | | |
80 | | QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const |
81 | 0 | { |
82 | 0 | return nullptr; |
83 | 0 | } |
84 | | |
85 | | QPlatformServices *QPlatformIntegration::services() const |
86 | 0 | { |
87 | 0 | return nullptr; |
88 | 0 | } |
89 | | |
90 | | /*! |
91 | | \class QPlatformIntegration |
92 | | \since 4.8 |
93 | | \internal |
94 | | \preliminary |
95 | | \ingroup qpa |
96 | | \brief The QPlatformIntegration class is the entry for WindowSystem specific functionality. |
97 | | |
98 | | QPlatformIntegration is the single entry point for windowsystem specific functionality when |
99 | | using the QPA platform. It has factory functions for creating platform specific pixmaps and |
100 | | windows. The class also controls the font subsystem. |
101 | | |
102 | | QPlatformIntegration is a singleton class which gets instantiated in the QGuiApplication |
103 | | constructor. The QPlatformIntegration instance do not have ownership of objects it creates in |
104 | | functions where the name starts with create. However, functions which don't have a name |
105 | | starting with create acts as accessors to member variables. |
106 | | |
107 | | It is not trivial to create or build a platform plugin outside of the Qt source tree. Therefore |
108 | | the recommended approach for making new platform plugin is to copy an existing plugin inside |
109 | | the QTSRCTREE/src/plugins/platform and develop the plugin inside the source tree. |
110 | | |
111 | | The minimal platform integration is the smallest platform integration it is possible to make, |
112 | | which makes it an ideal starting point for new plugins. For a slightly more advanced plugin, |
113 | | consider reviewing the directfb plugin, or the testlite plugin. |
114 | | */ |
115 | | |
116 | | /*! |
117 | | \fn QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const |
118 | | |
119 | | Factory function for QPlatformPixmap. PixelType can be either PixmapType or BitmapType. |
120 | | \sa QPlatformPixmap |
121 | | */ |
122 | | |
123 | | /*! |
124 | | \fn QPlatformWindow *QPlatformIntegration::createPlatformWindow(QWindow *window) const |
125 | | |
126 | | Factory function for QPlatformWindow. The \a window parameter is a pointer to the window |
127 | | which the QPlatformWindow is supposed to be created for. |
128 | | |
129 | | All windows have to have a QPlatformWindow, and it will be created on-demand when the |
130 | | QWindow is made visible for the first time, or explicitly through calling QWindow::create(). |
131 | | |
132 | | In the constructor, of the QPlatformWindow, the window flags, state, title and geometry |
133 | | of the \a window should be applied to the underlying window. If the resulting flags or state |
134 | | differs, the resulting values should be set on the \a window using QWindow::setWindowFlags() |
135 | | or QWindow::setWindowState(), respectively. |
136 | | |
137 | | \sa QPlatformWindow, QPlatformWindowFormat |
138 | | \sa createPlatformBackingStore() |
139 | | */ |
140 | | |
141 | | /*! |
142 | | \fn QPlatformBackingStore *QPlatformIntegration::createPlatformBackingStore(QWindow *window) const |
143 | | |
144 | | Factory function for QPlatformBackingStore. The QWindow parameter is a pointer to the |
145 | | top level widget(tlw) the window surface is created for. A QPlatformWindow is always created |
146 | | before the QPlatformBackingStore for tlw where the widget also requires a backing store. |
147 | | |
148 | | \sa QBackingStore |
149 | | \sa createPlatformWindow() |
150 | | */ |
151 | | |
152 | | /*! |
153 | | \enum QPlatformIntegration::Capability |
154 | | |
155 | | Capabilities are used to determine specific features of a platform integration |
156 | | |
157 | | \value ThreadedPixmaps The platform uses a pixmap implementation that is reentrant |
158 | | and can be used from multiple threads, like the raster paint engine and QImage based |
159 | | pixmaps. |
160 | | |
161 | | \value OpenGL The platform supports OpenGL |
162 | | |
163 | | \value ThreadedOpenGL The platform supports using OpenGL outside the GUI thread. |
164 | | |
165 | | \value SharedGraphicsCache The platform supports a shared graphics cache |
166 | | |
167 | | \value BufferQueueingOpenGL Deprecated. The OpenGL implementation on the platform will |
168 | | queue up buffers when swapBuffers() is called and block only when its buffer pipeline |
169 | | is full, rather than block immediately. |
170 | | |
171 | | \value MultipleWindows The platform supports multiple QWindows, i.e. does some kind |
172 | | of compositing either client or server side. Some platforms might only support a |
173 | | single fullscreen window. |
174 | | |
175 | | \value ApplicationState The platform handles the application state explicitly. |
176 | | This means that QEvent::ApplicationActivate and QEvent::ApplicationDeativate |
177 | | will not be posted automatically. Instead, the platform must handle application |
178 | | state explicitly by using QWindowSystemInterface::handleApplicationStateChanged(). |
179 | | If not set, application state will follow window activation, which is the normal |
180 | | behavior for desktop platforms. |
181 | | |
182 | | \value ForeignWindows The platform allows creating QWindows which represent |
183 | | native windows created by other processes or by using native libraries. |
184 | | |
185 | | \value NonFullScreenWindows The platform supports top-level windows which do not |
186 | | fill the screen. The default implementation returns \c true. Returning false for |
187 | | this will cause all windows, including dialogs and popups, to be resized to fill the |
188 | | screen. |
189 | | |
190 | | \value WindowManagement The platform is based on a system that performs window |
191 | | management. This includes the typical desktop platforms. Can be set to false on |
192 | | platforms where no window management is available, meaning for example that windows |
193 | | are never repositioned by the window manager. The default implementation returns \c true. |
194 | | |
195 | | \value AllGLFunctionsQueryable Deprecated. Used to indicate whether the QOpenGLContext |
196 | | backend provided by the platform is |
197 | | able to return function pointers from getProcAddress() even for standard OpenGL |
198 | | functions, for example OpenGL 1 functions like glClear() or glDrawArrays(). This is |
199 | | important because the OpenGL specifications do not require this ability from the |
200 | | getProcAddress implementations of the windowing system interfaces (EGL, WGL, GLX). The |
201 | | platform plugins may however choose to enhance the behavior in the backend |
202 | | implementation for QOpenGLContext::getProcAddress() and support returning a function |
203 | | pointer also for the standard, non-extension functions. This capability is a |
204 | | prerequisite for dynamic OpenGL loading. Starting with Qt 5.7, the platform plugin |
205 | | is required to have this capability. |
206 | | |
207 | | \value [since 5.5] ApplicationIcon The platform supports setting the application icon. |
208 | | |
209 | | \value TopStackedNativeChildWindows The platform supports native child windows via |
210 | | QWindowContainer without having to punch a transparent hole in the |
211 | | backingstore. (since 5.10) |
212 | | |
213 | | \value OpenGLOnRasterSurface The platform supports making a QOpenGLContext current |
214 | | in combination with a QWindow of type RasterSurface. |
215 | | |
216 | | \value PaintEvents The platform sends paint events instead of expose events when |
217 | | the window needs repainting. Expose events are only sent when a window is toggled |
218 | | from a non-exposed to exposed state or back. |
219 | | |
220 | | \value RhiBasedRendering The platform supports one or more of the 3D rendering APIs |
221 | | that Qt Quick and other components can use via the Qt Rendering Hardware Interface. On |
222 | | platforms where it is clear upfront that the platform cannot, or does not want to, |
223 | | support rendering via 3D graphics APIs such as OpenGL, Vulkan, Direct 3D, or Metal, |
224 | | this capability can be reported as \c false. That in effect means that in modules |
225 | | where there is an alternative, such as Qt Quick with its \c software backend, an |
226 | | automatic fallback to that alternative may occur, if applicable. The default |
227 | | implementation of hasCapability() returns \c true. |
228 | | |
229 | | \value ScreenWindowGrabbing The platform supports grabbing window on screen. |
230 | | On Wayland, this capability can be reported as \c false. The default implementation |
231 | | of hasCapability() returns \c true. |
232 | | |
233 | | \value BackingStoreStaticContents The platform backingstore supports static contents. |
234 | | On resize of the backingstore the static contents region is provided, and the backing |
235 | | store is expected to propagate the static content to the resized backing store, without |
236 | | clients needing to repaint the static content region. |
237 | | */ |
238 | | |
239 | | /*! |
240 | | |
241 | | \fn QAbstractEventDispatcher *QPlatformIntegration::createEventDispatcher() const = 0 |
242 | | |
243 | | Factory function for the GUI event dispatcher. The platform plugin should create |
244 | | and return a QAbstractEventDispatcher subclass when this function is called. |
245 | | |
246 | | If the platform plugin for some reason creates the event dispatcher outside of |
247 | | this function (for example in the constructor), it needs to handle the case |
248 | | where this function is never called, ensuring that the event dispatcher is |
249 | | still deleted at some point (typically in the destructor). |
250 | | |
251 | | Note that the platform plugin should never explicitly set the event dispatcher |
252 | | itself, using QCoreApplication::setEventDispatcher(), but let QCoreApplication |
253 | | decide when and which event dispatcher to create. |
254 | | |
255 | | \since 5.2 |
256 | | */ |
257 | | |
258 | | bool QPlatformIntegration::hasCapability(Capability cap) const |
259 | 0 | { |
260 | 0 | return cap == NonFullScreenWindows || cap == NativeWidgets || cap == WindowManagement |
261 | 0 | || cap == TopStackedNativeChildWindows || cap == WindowActivation |
262 | 0 | || cap == RhiBasedRendering || cap == ScreenWindowGrabbing; |
263 | 0 | } |
264 | | |
265 | | QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const |
266 | 0 | { |
267 | 0 | return new QRasterPlatformPixmap(type); |
268 | 0 | } |
269 | | |
270 | | #ifndef QT_NO_OPENGL |
271 | | /*! |
272 | | Factory function for QPlatformOpenGLContext. The \a context parameter is a pointer to |
273 | | the context for which a platform-specific context backend needs to be |
274 | | created. Configuration settings like the format, share context and screen have to be |
275 | | taken from this QOpenGLContext and the resulting platform context is expected to be |
276 | | backed by a native context that fulfills these criteria. |
277 | | |
278 | | If the context has native handles set, no new native context is expected to be created. |
279 | | Instead, the provided handles have to be used. In this case the ownership of the handle |
280 | | must not be taken and the platform implementation is not allowed to destroy the native |
281 | | context. Configuration parameters like the format are also to be ignored. Instead, the |
282 | | platform implementation is responsible for querying the configuriation from the provided |
283 | | native context. |
284 | | |
285 | | Returns a pointer to a QPlatformOpenGLContext instance or \nullptr if the context could |
286 | | not be created. |
287 | | |
288 | | \sa QOpenGLContext |
289 | | */ |
290 | | QPlatformOpenGLContext *QPlatformIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const |
291 | | { |
292 | | Q_UNUSED(context); |
293 | | qWarning("This plugin does not support createPlatformOpenGLContext!"); |
294 | | return nullptr; |
295 | | } |
296 | | #endif // QT_NO_OPENGL |
297 | | |
298 | | /*! |
299 | | Factory function for QPlatformSharedGraphicsCache. This function will return 0 if the platform |
300 | | integration does not support any shared graphics cache mechanism for the given \a cacheId. |
301 | | */ |
302 | | QPlatformSharedGraphicsCache *QPlatformIntegration::createPlatformSharedGraphicsCache(const char *cacheId) const |
303 | 0 | { |
304 | 0 | qWarning("This plugin does not support createPlatformSharedGraphicsBuffer for cacheId: %s!", |
305 | 0 | cacheId); |
306 | 0 | return nullptr; |
307 | 0 | } |
308 | | |
309 | | /*! |
310 | | Factory function for QPaintEngine. This function will return 0 if the platform |
311 | | integration does not support creating any paint engine the given \a paintDevice. |
312 | | */ |
313 | | QPaintEngine *QPlatformIntegration::createImagePaintEngine(QPaintDevice *paintDevice) const |
314 | 0 | { |
315 | 0 | Q_UNUSED(paintDevice); |
316 | 0 | return nullptr; |
317 | 0 | } |
318 | | |
319 | | /*! |
320 | | Performs initialization steps that depend on having an event dispatcher |
321 | | available. Called after the event dispatcher has been created. |
322 | | |
323 | | Tasks that require an event dispatcher, for example creating socket notifiers, cannot be |
324 | | performed in the constructor. Instead, they should be performed here. The default |
325 | | implementation does nothing. |
326 | | */ |
327 | | void QPlatformIntegration::initialize() |
328 | 0 | { |
329 | 0 | } |
330 | | |
331 | | /*! |
332 | | Called before the platform integration is deleted. Useful when cleanup relies on virtual |
333 | | functions. |
334 | | |
335 | | \since 5.5 |
336 | | */ |
337 | | void QPlatformIntegration::destroy() |
338 | 0 | { |
339 | 0 | } |
340 | | |
341 | | /*! |
342 | | Returns the platforms input context. |
343 | | |
344 | | The default implementation returns \nullptr, implying no input method support. |
345 | | */ |
346 | | QPlatformInputContext *QPlatformIntegration::inputContext() const |
347 | 0 | { |
348 | 0 | return nullptr; |
349 | 0 | } |
350 | | |
351 | | /*! |
352 | | Accessor for the platform integration's key mapper. |
353 | | |
354 | | Default implementation returns a default QPlatformKeyMapper. |
355 | | |
356 | | \sa QPlatformKeyMapper |
357 | | */ |
358 | | QPlatformKeyMapper *QPlatformIntegration::keyMapper() const |
359 | 0 | { |
360 | 0 | static QPlatformKeyMapper *keyMapper = nullptr; |
361 | 0 | if (!keyMapper) |
362 | 0 | keyMapper = new QPlatformKeyMapper; |
363 | 0 | return keyMapper; |
364 | 0 | } |
365 | | |
366 | | #if QT_CONFIG(accessibility) |
367 | | |
368 | | /*! |
369 | | Returns the platforms accessibility. |
370 | | |
371 | | The default implementation returns QPlatformAccessibility which |
372 | | delegates handling of accessibility to accessiblebridge plugins. |
373 | | */ |
374 | | QPlatformAccessibility *QPlatformIntegration::accessibility() const |
375 | 0 | { |
376 | 0 | static QPlatformAccessibility *accessibility = nullptr; |
377 | 0 | if (Q_UNLIKELY(!accessibility)) { |
378 | 0 | accessibility = new QPlatformAccessibility; |
379 | 0 | } |
380 | 0 | return accessibility; |
381 | 0 | } |
382 | | |
383 | | #endif |
384 | | |
385 | | QVariant QPlatformIntegration::styleHint(StyleHint hint) const |
386 | 0 | { |
387 | 0 | switch (hint) { |
388 | 0 | case CursorFlashTime: |
389 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::CursorFlashTime); |
390 | 0 | case KeyboardInputInterval: |
391 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::KeyboardInputInterval); |
392 | 0 | case KeyboardAutoRepeatRate: |
393 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::KeyboardAutoRepeatRate); |
394 | 0 | case MouseDoubleClickInterval: |
395 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::MouseDoubleClickInterval); |
396 | 0 | case StartDragDistance: |
397 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragDistance); |
398 | 0 | case StartDragTime: |
399 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragTime); |
400 | 0 | case ShowIsFullScreen: |
401 | 0 | return false; |
402 | 0 | case ShowIsMaximized: |
403 | 0 | return false; |
404 | 0 | case ShowShortcutsInContextMenus: |
405 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::ShowShortcutsInContextMenus); |
406 | 0 | case PasswordMaskDelay: |
407 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::PasswordMaskDelay); |
408 | 0 | case PasswordMaskCharacter: |
409 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::PasswordMaskCharacter); |
410 | 0 | case FontSmoothingGamma: |
411 | 0 | return qreal(1.7); |
412 | 0 | case StartDragVelocity: |
413 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragVelocity); |
414 | 0 | case UseRtlExtensions: |
415 | 0 | return QVariant(false); |
416 | 0 | case SetFocusOnTouchRelease: |
417 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::SetFocusOnTouchRelease); |
418 | 0 | case MousePressAndHoldInterval: |
419 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::MousePressAndHoldInterval); |
420 | 0 | case TabFocusBehavior: |
421 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::TabFocusBehavior); |
422 | 0 | case ReplayMousePressOutsidePopup: |
423 | 0 | return true; |
424 | 0 | case ItemViewActivateItemOnSingleClick: |
425 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::ItemViewActivateItemOnSingleClick); |
426 | 0 | case UiEffects: |
427 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::UiEffects); |
428 | 0 | case WheelScrollLines: |
429 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::WheelScrollLines); |
430 | 0 | case MouseQuickSelectionThreshold: |
431 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::MouseQuickSelectionThreshold); |
432 | 0 | case MouseDoubleClickDistance: |
433 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::MouseDoubleClickDistance); |
434 | 0 | case FlickStartDistance: |
435 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::FlickStartDistance); |
436 | 0 | case FlickMaximumVelocity: |
437 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::FlickMaximumVelocity); |
438 | 0 | case FlickDeceleration: |
439 | 0 | return QPlatformTheme::defaultThemeHint(QPlatformTheme::FlickDeceleration); |
440 | 0 | case UnderlineShortcut: |
441 | 0 | return true; |
442 | 0 | } |
443 | | |
444 | 0 | return 0; |
445 | 0 | } |
446 | | |
447 | | Qt::WindowState QPlatformIntegration::defaultWindowState(Qt::WindowFlags flags) const |
448 | 0 | { |
449 | | // Leave popup-windows as is |
450 | 0 | if (flags & Qt::Popup & ~Qt::Window) |
451 | 0 | return Qt::WindowNoState; |
452 | | |
453 | 0 | if (flags & Qt::SubWindow) |
454 | 0 | return Qt::WindowNoState; |
455 | | |
456 | 0 | if (styleHint(QPlatformIntegration::ShowIsFullScreen).toBool()) |
457 | 0 | return Qt::WindowFullScreen; |
458 | 0 | else if (styleHint(QPlatformIntegration::ShowIsMaximized).toBool()) |
459 | 0 | return Qt::WindowMaximized; |
460 | | |
461 | 0 | return Qt::WindowNoState; |
462 | 0 | } |
463 | | |
464 | | Qt::KeyboardModifiers QPlatformIntegration::queryKeyboardModifiers() const |
465 | 0 | { |
466 | 0 | return QGuiApplication::keyboardModifiers(); |
467 | 0 | } |
468 | | |
469 | | /*! |
470 | | Should be used to obtain a list of possible shortcuts for the given key |
471 | | event. Shortcuts should be encoded as int(Qt::Key + Qt::KeyboardModifiers). |
472 | | |
473 | | One example for more than one possibility is the key combination of Shift+5. |
474 | | That one might trigger a shortcut which is set as "Shift+5" as well as one |
475 | | using %. These combinations depend on the currently set keyboard layout. |
476 | | |
477 | | \note This function should be called only from key event handlers. |
478 | | */ |
479 | | QList<int> QPlatformIntegration::possibleKeys(const QKeyEvent *) const |
480 | 0 | { |
481 | 0 | return QList<int>(); |
482 | 0 | } |
483 | | |
484 | | QStringList QPlatformIntegration::themeNames() const |
485 | 0 | { |
486 | 0 | return QStringList(); |
487 | 0 | } |
488 | | |
489 | | class QPlatformTheme *QPlatformIntegration::createPlatformTheme(const QString &name) const |
490 | 0 | { |
491 | 0 | Q_UNUSED(name); |
492 | 0 | return new QPlatformTheme; |
493 | 0 | } |
494 | | |
495 | | /*! |
496 | | Factory function for QOffscreenSurface. An offscreen surface will typically be implemented with a |
497 | | pixel buffer (pbuffer). If the platform doesn't support offscreen surfaces, an invisible window |
498 | | will be used by QOffscreenSurface instead. |
499 | | |
500 | | If the platform has the OffscreenSurface capability, this should always return a valid pointer. |
501 | | */ |
502 | | QPlatformOffscreenSurface *QPlatformIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const |
503 | 0 | { |
504 | 0 | Q_UNUSED(surface); |
505 | 0 | return nullptr; |
506 | 0 | } |
507 | | |
508 | | #ifndef QT_NO_SESSIONMANAGER |
509 | | /*! |
510 | | \since 5.2 |
511 | | |
512 | | Factory function for QPlatformSessionManager. The default QPlatformSessionManager provides the same |
513 | | functionality as the QSessionManager. |
514 | | */ |
515 | | QPlatformSessionManager *QPlatformIntegration::createPlatformSessionManager(const QString &id, const QString &key) const |
516 | 0 | { |
517 | 0 | return new QPlatformSessionManager(id, key); |
518 | 0 | } |
519 | | #endif |
520 | | |
521 | | /*! |
522 | | \since 5.2 |
523 | | |
524 | | Function to sync the platform integrations state with the window system. |
525 | | |
526 | | This is often implemented as a roundtrip from the platformintegration to the window system. |
527 | | |
528 | | This function should not call QWindowSystemInterface::flushWindowSystemEvents() or |
529 | | QCoreApplication::processEvents() |
530 | | */ |
531 | | void QPlatformIntegration::sync() |
532 | 0 | { |
533 | 0 | } |
534 | | |
535 | | /*! |
536 | | \since 5.7 |
537 | | |
538 | | Should sound a bell, using the default volume and sound. |
539 | | |
540 | | \sa QApplication::beep() |
541 | | */ |
542 | | void QPlatformIntegration::beep() const |
543 | 0 | { |
544 | 0 | } |
545 | | |
546 | | /*! |
547 | | \since 6.0 |
548 | | |
549 | | Asks the platform to terminate the application. |
550 | | |
551 | | Overrides should ensure there's a callback into the QWSI |
552 | | function handleApplicationTermination so that the quit can |
553 | | be propagated to QtGui and the application. |
554 | | */ |
555 | | void QPlatformIntegration::quit() const |
556 | 0 | { |
557 | 0 | QWindowSystemInterface::handleApplicationTermination<QWindowSystemInterface::SynchronousDelivery>(); |
558 | 0 | } |
559 | | |
560 | | #ifndef QT_NO_OPENGL |
561 | | /*! |
562 | | Platform integration function for querying the OpenGL implementation type. |
563 | | |
564 | | Used only when dynamic OpenGL implementation loading is enabled. |
565 | | |
566 | | Subclasses should reimplement this function and return a value based on |
567 | | the OpenGL implementation they have chosen to load. |
568 | | |
569 | | \note The return value does not indicate or limit the types of |
570 | | contexts that can be created by a given implementation. For example |
571 | | a desktop OpenGL implementation may be capable of creating OpenGL |
572 | | ES-compatible contexts too. |
573 | | |
574 | | \sa QOpenGLContext::openGLModuleType(), QOpenGLContext::isOpenGLES() |
575 | | |
576 | | \since 5.3 |
577 | | */ |
578 | | QOpenGLContext::OpenGLModuleType QPlatformIntegration::openGLModuleType() |
579 | | { |
580 | | qWarning("This plugin does not support dynamic OpenGL loading!"); |
581 | | return QOpenGLContext::LibGL; |
582 | | } |
583 | | #endif |
584 | | |
585 | | /*! |
586 | | \since 5.5 |
587 | | |
588 | | Platform integration function for setting the application icon. |
589 | | |
590 | | \sa QGuiApplication::setWindowIcon() |
591 | | */ |
592 | | void QPlatformIntegration::setApplicationIcon(const QIcon &icon) const |
593 | 0 | { |
594 | 0 | Q_UNUSED(icon); |
595 | 0 | } |
596 | | |
597 | | /*! |
598 | | \since 6.5 |
599 | | |
600 | | Should set the application's badge to \a number. |
601 | | |
602 | | If the number is 0 the badge should be cleared. |
603 | | |
604 | | \sa QGuiApplication::setBadge() |
605 | | */ |
606 | | void QPlatformIntegration::setApplicationBadge(qint64 number) |
607 | 0 | { |
608 | | Q_UNUSED(number); |
609 | 0 | } |
610 | | |
611 | | #if QT_CONFIG(vulkan) || defined(Q_QDOC) |
612 | | |
613 | | /*! |
614 | | Factory function for QPlatformVulkanInstance. The \a instance parameter is a |
615 | | pointer to the instance for which a platform-specific backend needs to be |
616 | | created. |
617 | | |
618 | | Returns a pointer to a QPlatformOpenGLContext instance or \nullptr if the context could |
619 | | not be created. |
620 | | |
621 | | \sa QVulkanInstance |
622 | | \since 5.10 |
623 | | */ |
624 | | QPlatformVulkanInstance *QPlatformIntegration::createPlatformVulkanInstance(QVulkanInstance *instance) const |
625 | | { |
626 | | Q_UNUSED(instance); |
627 | | qWarning("This plugin does not support createPlatformVulkanInstance"); |
628 | | return nullptr; |
629 | | } |
630 | | |
631 | | #endif // QT_CONFIG(vulkan) |
632 | | |
633 | | QT_END_NAMESPACE |