| 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 | { |
| 34 | static QPlatformFontDatabase *db = nullptr; |
| 35 | if (!db) { |
| 36 | db = new QPlatformFontDatabase; |
| 37 | } |
| 38 | return db; |
| 39 | } |
| 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 | { |
| 54 | static QPlatformClipboard *clipboard = nullptr; |
| 55 | if (!clipboard) { |
| 56 | clipboard = new QPlatformClipboard; |
| 57 | } |
| 58 | return clipboard; |
| 59 | } |
| 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 | { |
| 72 | static QSimpleDrag *drag = nullptr; |
| 73 | if (!drag) { |
| 74 | drag = new QSimpleDrag; |
| 75 | } |
| 76 | return drag; |
| 77 | } |
| 78 | #endif // QT_CONFIG(draganddrop) |
| 79 | |
| 80 | QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const |
| 81 | { |
| 82 | return nullptr; |
| 83 | } |
| 84 | |
| 85 | QPlatformServices *QPlatformIntegration::services() const |
| 86 | { |
| 87 | return nullptr; |
| 88 | } |
| 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 ApplicationIcon The platform supports setting the application icon. (since 5.5) |
| 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 | { |
| 260 | return cap == NonFullScreenWindows || cap == NativeWidgets || cap == WindowManagement |
| 261 | || cap == TopStackedNativeChildWindows || cap == WindowActivation |
| 262 | || cap == RhiBasedRendering || cap == ScreenWindowGrabbing; |
| 263 | } |
| 264 | |
| 265 | QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const |
| 266 | { |
| 267 | return new QRasterPlatformPixmap(type); |
| 268 | } |
| 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(msg: "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 | { |
| 304 | qWarning(msg: "This plugin does not support createPlatformSharedGraphicsBuffer for cacheId: %s!" , |
| 305 | cacheId); |
| 306 | return nullptr; |
| 307 | } |
| 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 | { |
| 315 | Q_UNUSED(paintDevice); |
| 316 | return nullptr; |
| 317 | } |
| 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 | { |
| 329 | } |
| 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 | { |
| 339 | } |
| 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 | { |
| 348 | return nullptr; |
| 349 | } |
| 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 | { |
| 360 | static QPlatformKeyMapper *keyMapper = nullptr; |
| 361 | if (!keyMapper) |
| 362 | keyMapper = new QPlatformKeyMapper; |
| 363 | return keyMapper; |
| 364 | } |
| 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 | { |
| 376 | static QPlatformAccessibility *accessibility = nullptr; |
| 377 | if (Q_UNLIKELY(!accessibility)) { |
| 378 | accessibility = new QPlatformAccessibility; |
| 379 | } |
| 380 | return accessibility; |
| 381 | } |
| 382 | |
| 383 | #endif |
| 384 | |
| 385 | QVariant QPlatformIntegration::styleHint(StyleHint hint) const |
| 386 | { |
| 387 | switch (hint) { |
| 388 | case CursorFlashTime: |
| 389 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::CursorFlashTime); |
| 390 | case KeyboardInputInterval: |
| 391 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::KeyboardInputInterval); |
| 392 | case KeyboardAutoRepeatRate: |
| 393 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::KeyboardAutoRepeatRate); |
| 394 | case MouseDoubleClickInterval: |
| 395 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::MouseDoubleClickInterval); |
| 396 | case StartDragDistance: |
| 397 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::StartDragDistance); |
| 398 | case StartDragTime: |
| 399 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::StartDragTime); |
| 400 | case ShowIsFullScreen: |
| 401 | return false; |
| 402 | case ShowIsMaximized: |
| 403 | return false; |
| 404 | case ShowShortcutsInContextMenus: |
| 405 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::ShowShortcutsInContextMenus); |
| 406 | case PasswordMaskDelay: |
| 407 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::PasswordMaskDelay); |
| 408 | case PasswordMaskCharacter: |
| 409 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::PasswordMaskCharacter); |
| 410 | case FontSmoothingGamma: |
| 411 | return qreal(1.7); |
| 412 | case StartDragVelocity: |
| 413 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::StartDragVelocity); |
| 414 | case UseRtlExtensions: |
| 415 | return QVariant(false); |
| 416 | case SetFocusOnTouchRelease: |
| 417 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::SetFocusOnTouchRelease); |
| 418 | case MousePressAndHoldInterval: |
| 419 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::MousePressAndHoldInterval); |
| 420 | case TabFocusBehavior: |
| 421 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::TabFocusBehavior); |
| 422 | case ReplayMousePressOutsidePopup: |
| 423 | return true; |
| 424 | case ItemViewActivateItemOnSingleClick: |
| 425 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::ItemViewActivateItemOnSingleClick); |
| 426 | case UiEffects: |
| 427 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::UiEffects); |
| 428 | case WheelScrollLines: |
| 429 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::WheelScrollLines); |
| 430 | case MouseQuickSelectionThreshold: |
| 431 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::MouseQuickSelectionThreshold); |
| 432 | case MouseDoubleClickDistance: |
| 433 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::MouseDoubleClickDistance); |
| 434 | case FlickStartDistance: |
| 435 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::FlickStartDistance); |
| 436 | case FlickMaximumVelocity: |
| 437 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::FlickMaximumVelocity); |
| 438 | case FlickDeceleration: |
| 439 | return QPlatformTheme::defaultThemeHint(hint: QPlatformTheme::FlickDeceleration); |
| 440 | case UnderlineShortcut: |
| 441 | return true; |
| 442 | } |
| 443 | |
| 444 | return 0; |
| 445 | } |
| 446 | |
| 447 | Qt::WindowState QPlatformIntegration::defaultWindowState(Qt::WindowFlags flags) const |
| 448 | { |
| 449 | // Leave popup-windows as is |
| 450 | if (flags & Qt::Popup & ~Qt::Window) |
| 451 | return Qt::WindowNoState; |
| 452 | |
| 453 | if (flags & Qt::SubWindow) |
| 454 | return Qt::WindowNoState; |
| 455 | |
| 456 | if (styleHint(hint: QPlatformIntegration::ShowIsFullScreen).toBool()) |
| 457 | return Qt::WindowFullScreen; |
| 458 | else if (styleHint(hint: QPlatformIntegration::ShowIsMaximized).toBool()) |
| 459 | return Qt::WindowMaximized; |
| 460 | |
| 461 | return Qt::WindowNoState; |
| 462 | } |
| 463 | |
| 464 | Qt::KeyboardModifiers QPlatformIntegration::queryKeyboardModifiers() const |
| 465 | { |
| 466 | return QGuiApplication::keyboardModifiers(); |
| 467 | } |
| 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 | { |
| 481 | return QList<int>(); |
| 482 | } |
| 483 | |
| 484 | QStringList QPlatformIntegration::themeNames() const |
| 485 | { |
| 486 | return QStringList(); |
| 487 | } |
| 488 | |
| 489 | class QPlatformTheme *QPlatformIntegration::createPlatformTheme(const QString &name) const |
| 490 | { |
| 491 | Q_UNUSED(name); |
| 492 | return new QPlatformTheme; |
| 493 | } |
| 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 | QPlatformOffscreenSurface *QPlatformIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const |
| 501 | { |
| 502 | Q_UNUSED(surface); |
| 503 | return nullptr; |
| 504 | } |
| 505 | |
| 506 | #ifndef QT_NO_SESSIONMANAGER |
| 507 | /*! |
| 508 | \since 5.2 |
| 509 | |
| 510 | Factory function for QPlatformSessionManager. The default QPlatformSessionManager provides the same |
| 511 | functionality as the QSessionManager. |
| 512 | */ |
| 513 | QPlatformSessionManager *QPlatformIntegration::createPlatformSessionManager(const QString &id, const QString &key) const |
| 514 | { |
| 515 | return new QPlatformSessionManager(id, key); |
| 516 | } |
| 517 | #endif |
| 518 | |
| 519 | /*! |
| 520 | \since 5.2 |
| 521 | |
| 522 | Function to sync the platform integrations state with the window system. |
| 523 | |
| 524 | This is often implemented as a roundtrip from the platformintegration to the window system. |
| 525 | |
| 526 | This function should not call QWindowSystemInterface::flushWindowSystemEvents() or |
| 527 | QCoreApplication::processEvents() |
| 528 | */ |
| 529 | void QPlatformIntegration::sync() |
| 530 | { |
| 531 | } |
| 532 | |
| 533 | /*! |
| 534 | \since 5.7 |
| 535 | |
| 536 | Should sound a bell, using the default volume and sound. |
| 537 | |
| 538 | \sa QApplication::beep() |
| 539 | */ |
| 540 | void QPlatformIntegration::beep() const |
| 541 | { |
| 542 | } |
| 543 | |
| 544 | /*! |
| 545 | \since 6.0 |
| 546 | |
| 547 | Asks the platform to terminate the application. |
| 548 | |
| 549 | Overrides should ensure there's a callback into the QWSI |
| 550 | function handleApplicationTermination so that the quit can |
| 551 | be propagated to QtGui and the application. |
| 552 | */ |
| 553 | void QPlatformIntegration::quit() const |
| 554 | { |
| 555 | QWindowSystemInterface::handleApplicationTermination<QWindowSystemInterface::SynchronousDelivery>(); |
| 556 | } |
| 557 | |
| 558 | #ifndef QT_NO_OPENGL |
| 559 | /*! |
| 560 | Platform integration function for querying the OpenGL implementation type. |
| 561 | |
| 562 | Used only when dynamic OpenGL implementation loading is enabled. |
| 563 | |
| 564 | Subclasses should reimplement this function and return a value based on |
| 565 | the OpenGL implementation they have chosen to load. |
| 566 | |
| 567 | \note The return value does not indicate or limit the types of |
| 568 | contexts that can be created by a given implementation. For example |
| 569 | a desktop OpenGL implementation may be capable of creating OpenGL |
| 570 | ES-compatible contexts too. |
| 571 | |
| 572 | \sa QOpenGLContext::openGLModuleType(), QOpenGLContext::isOpenGLES() |
| 573 | |
| 574 | \since 5.3 |
| 575 | */ |
| 576 | QOpenGLContext::OpenGLModuleType QPlatformIntegration::openGLModuleType() |
| 577 | { |
| 578 | qWarning(msg: "This plugin does not support dynamic OpenGL loading!" ); |
| 579 | return QOpenGLContext::LibGL; |
| 580 | } |
| 581 | #endif |
| 582 | |
| 583 | /*! |
| 584 | \since 5.5 |
| 585 | |
| 586 | Platform integration function for setting the application icon. |
| 587 | |
| 588 | \sa QGuiApplication::setWindowIcon() |
| 589 | */ |
| 590 | void QPlatformIntegration::setApplicationIcon(const QIcon &icon) const |
| 591 | { |
| 592 | Q_UNUSED(icon); |
| 593 | } |
| 594 | |
| 595 | /*! |
| 596 | \since 6.5 |
| 597 | |
| 598 | Should set the application's badge to \a number. |
| 599 | |
| 600 | If the number is 0 the badge should be cleared. |
| 601 | |
| 602 | \sa QGuiApplication::setBadge() |
| 603 | */ |
| 604 | void QPlatformIntegration::setApplicationBadge(qint64 number) |
| 605 | { |
| 606 | Q_UNUSED(number); |
| 607 | } |
| 608 | |
| 609 | #if QT_CONFIG(vulkan) || defined(Q_QDOC) |
| 610 | |
| 611 | /*! |
| 612 | Factory function for QPlatformVulkanInstance. The \a instance parameter is a |
| 613 | pointer to the instance for which a platform-specific backend needs to be |
| 614 | created. |
| 615 | |
| 616 | Returns a pointer to a QPlatformOpenGLContext instance or \nullptr if the context could |
| 617 | not be created. |
| 618 | |
| 619 | \sa QVulkanInstance |
| 620 | \since 5.10 |
| 621 | */ |
| 622 | QPlatformVulkanInstance *QPlatformIntegration::createPlatformVulkanInstance(QVulkanInstance *instance) const |
| 623 | { |
| 624 | Q_UNUSED(instance); |
| 625 | qWarning(msg: "This plugin does not support createPlatformVulkanInstance" ); |
| 626 | return nullptr; |
| 627 | } |
| 628 | |
| 629 | #endif // QT_CONFIG(vulkan) |
| 630 | |
| 631 | QT_END_NAMESPACE |
| 632 | |