QtBase  v6.3.1
Public Types | Public Member Functions | Protected Member Functions | List of all members
QPlatformIntegration Class Referenceabstract

#include <qplatformintegration.h>

Inheritance diagram for QPlatformIntegration:
Inheritance graph
[legend]

Public Types

enum  Capability {
  ThreadedPixmaps = 1 , OpenGL , ThreadedOpenGL , SharedGraphicsCache ,
  BufferQueueingOpenGL , WindowMasks , MultipleWindows , ApplicationState ,
  ForeignWindows , NonFullScreenWindows , NativeWidgets , WindowManagement ,
  WindowActivation , SyncState , RasterGLSurface , AllGLFunctionsQueryable ,
  ApplicationIcon , SwitchableWidgetComposition , TopStackedNativeChildWindows , OpenGLOnRasterSurface ,
  MaximizeUsingFullscreenGeometry , PaintEvents , RhiBasedRendering
}
 
enum  StyleHint {
  CursorFlashTime , KeyboardInputInterval , MouseDoubleClickInterval , StartDragDistance ,
  StartDragTime , KeyboardAutoRepeatRate , ShowIsFullScreen , PasswordMaskDelay ,
  FontSmoothingGamma , StartDragVelocity , UseRtlExtensions , PasswordMaskCharacter ,
  SetFocusOnTouchRelease , ShowIsMaximized , MousePressAndHoldInterval , TabFocusBehavior ,
  ReplayMousePressOutsidePopup , ItemViewActivateItemOnSingleClick , UiEffects , WheelScrollLines ,
  ShowShortcutsInContextMenus , MouseQuickSelectionThreshold
}
 

Public Member Functions

virtual ~QPlatformIntegration ()
 
virtual bool hasCapability (Capability cap) const
 
virtual QPlatformPixmapcreatePlatformPixmap (QPlatformPixmap::PixelType type) const
 
virtual QPlatformWindowcreatePlatformWindow (QWindow *window) const =0
 
virtual QPlatformWindowcreateForeignWindow (QWindow *, WId) const
 
virtual QPlatformBackingStorecreatePlatformBackingStore (QWindow *window) const =0
 
virtual QPlatformOpenGLContextcreatePlatformOpenGLContext (QOpenGLContext *context) const
 
virtual QPlatformSharedGraphicsCachecreatePlatformSharedGraphicsCache (const char *cacheId) const
 
virtual QPaintEnginecreateImagePaintEngine (QPaintDevice *paintDevice) const
 
virtual QAbstractEventDispatchercreateEventDispatcher () const =0
 
virtual void initialize ()
 
virtual void destroy ()
 
virtual QPlatformFontDatabasefontDatabase () const
 
virtual QPlatformClipboardclipboard () const
 
virtual QPlatformInputContextinputContext () const
 
virtual QPlatformAccessibilityaccessibility () const
 
virtual QPlatformNativeInterfacenativeInterface () const
 
virtual QPlatformServicesservices () const
 
virtual QVariant styleHint (StyleHint hint) const
 
virtual Qt::WindowState defaultWindowState (Qt::WindowFlags) const
 
virtual Qt::KeyboardModifiers queryKeyboardModifiers () const
 
virtual QList< int > possibleKeys (const QKeyEvent *) const
 
virtual QStringList themeNames () const
 
virtual QPlatformThemecreatePlatformTheme (const QString &name) const
 
virtual QPlatformOffscreenSurfacecreatePlatformOffscreenSurface (QOffscreenSurface *surface) const
 
virtual QPlatformSessionManagercreatePlatformSessionManager (const QString &id, const QString &key) const
 
virtual void sync ()
 
virtual QOpenGLContext::OpenGLModuleType openGLModuleType ()
 
virtual void setApplicationIcon (const QIcon &icon) const
 
virtual void beep () const
 
virtual void quit () const
 
template<auto func, typename... Args>
auto call (Args... args)
 

Protected Member Functions

 QPlatformIntegration ()=default
 

Detailed Description

Since
4.8

Definition at line 108 of file qplatformintegration.h.

Member Enumeration Documentation

◆ Capability

Capabilities are used to determing specific features of a platform integration

\value ThreadedPixmaps The platform uses a pixmap implementation that is reentrant and can be used from multiple threads, like the raster paint engine and QImage based pixmaps.

\value OpenGL The platform supports OpenGL

\value ThreadedOpenGL The platform supports using OpenGL outside the GUI thread.

\value SharedGraphicsCache The platform supports a shared graphics cache

\value BufferQueueingOpenGL Deprecated. The OpenGL implementation on the platform will queue up buffers when swapBuffers() is called and block only when its buffer pipeline is full, rather than block immediately.

\value MultipleWindows The platform supports multiple QWindows, i.e. does some kind of compositing either client or server side. Some platforms might only support a single fullscreen window.

\value ApplicationState The platform handles the application state explicitly. This means that QEvent::ApplicationActivate and QEvent::ApplicationDeativate will not be posted automatically. Instead, the platform must handle application state explicitly by using QWindowSystemInterface::handleApplicationStateChanged(). If not set, application state will follow window activation, which is the normal behavior for desktop platforms.

\value ForeignWindows The platform allows creating QWindows which represent native windows created by other processes or by using native libraries.

\value NonFullScreenWindows The platform supports top-level windows which do not fill the screen. The default implementation returns true. Returning false for this will cause all windows, including dialogs and popups, to be resized to fill the screen.

\value WindowManagement The platform is based on a system that performs window management. This includes the typical desktop platforms. Can be set to false on platforms where no window management is available, meaning for example that windows are never repositioned by the window manager. The default implementation returns true.

\value AllGLFunctionsQueryable Deprecated. Used to indicate whether the QOpenGLContext backend provided by the platform is able to return function pointers from getProcAddress() even for standard OpenGL functions, for example OpenGL 1 functions like glClear() or glDrawArrays(). This is important because the OpenGL specifications do not require this ability from the getProcAddress implementations of the windowing system interfaces (EGL, WGL, GLX). The platform plugins may however choose to enhance the behavior in the backend implementation for QOpenGLContext::getProcAddress() and support returning a function pointer also for the standard, non-extension functions. This capability is a prerequisite for dynamic OpenGL loading. Starting with Qt 5.7, the platform plugin is required to have this capability.

\value ApplicationIcon The platform supports setting the application icon. (since 5.5)

\value TopStackedNativeChildWindows The platform supports native child windows via QWindowContainer without having to punch a transparent hole in the backingstore. (since 5.10)

\value OpenGLOnRasterSurface The platform supports making a QOpenGLContext current in combination with a QWindow of type RasterSurface.

\value PaintEvents The platform sends paint events instead of expose events when the window needs repainting. Expose events are only sent when a window is toggled from a non-exposed to exposed state or back.

\value RhiBasedRendering The platform supports one or more of the 3D rendering APIs that Qt Quick and other components can use via the Qt Rendering Hardware Interface. On platforms where it is clear upfront that the platform cannot, or does not want to, support rendering via 3D graphics APIs such as OpenGL, Vulkan, Direct 3D, or Metal, this capability can be reported as false. That in effect means that in modules where there is an alternative, such as Qt Quick with its software backend, an automatic fallback to that alternative may occur, if applicable. The default implementation of hasCapability() returns true.

Enumerator
ThreadedPixmaps 
OpenGL 
ThreadedOpenGL 
SharedGraphicsCache 
BufferQueueingOpenGL 
WindowMasks 
MultipleWindows 
ApplicationState 
ForeignWindows 
NonFullScreenWindows 
NativeWidgets 
WindowManagement 
WindowActivation 
SyncState 
RasterGLSurface 
AllGLFunctionsQueryable 
ApplicationIcon 
SwitchableWidgetComposition 
TopStackedNativeChildWindows 
OpenGLOnRasterSurface 
MaximizeUsingFullscreenGeometry 
PaintEvents 
RhiBasedRendering 

Definition at line 113 of file qplatformintegration.h.

◆ StyleHint

Enumerator
CursorFlashTime 
KeyboardInputInterval 
MouseDoubleClickInterval 
StartDragDistance 
StartDragTime 
KeyboardAutoRepeatRate 
ShowIsFullScreen 
PasswordMaskDelay 
FontSmoothingGamma 
StartDragVelocity 
UseRtlExtensions 
PasswordMaskCharacter 
SetFocusOnTouchRelease 
ShowIsMaximized 
MousePressAndHoldInterval 
TabFocusBehavior 
ReplayMousePressOutsidePopup 
ItemViewActivateItemOnSingleClick 
UiEffects 
WheelScrollLines 
ShowShortcutsInContextMenus 
MouseQuickSelectionThreshold 

Definition at line 176 of file qplatformintegration.h.

Constructor & Destructor Documentation

◆ ~QPlatformIntegration()

virtual QPlatformIntegration::~QPlatformIntegration ( )
inlinevirtual

Definition at line 139 of file qplatformintegration.h.

◆ QPlatformIntegration()

QPlatformIntegration::QPlatformIntegration ( )
protecteddefault

Member Function Documentation

◆ accessibility()

QPlatformAccessibility * QPlatformIntegration::accessibility ( ) const
virtual

Returns the platforms accessibility.

The default implementation returns QPlatformAccessibility which delegates handling of accessibility to accessiblebridge plugins.

Reimplemented in QXcbIntegration, QIOSIntegration, QCocoaIntegration, and QAndroidPlatformIntegration.

Definition at line 384 of file qplatformintegration.cpp.

◆ beep()

void QPlatformIntegration::beep ( ) const
virtual
Since
5.7

Should sound a bell, using the default volume and sound.

See also
QApplication::beep()

Reimplemented in QXcbIntegration, QWindowsIntegration, QIOSIntegration, and QCocoaIntegration.

Definition at line 540 of file qplatformintegration.cpp.

Here is the caller graph for this function:

◆ call()

template<auto func, typename... Args>
auto QPlatformIntegration::call ( Args...  args)
inline

Definition at line 231 of file qplatformintegration.h.

◆ clipboard()

QPlatformClipboard * QPlatformIntegration::clipboard ( ) const
virtual

Accessor for the platform integration's clipboard.

Default implementation returns a default QPlatformClipboard.

See also
QPlatformClipboard

Reimplemented in QXcbIntegration, QWasmIntegration, QQnxIntegration, QIOSIntegration, QHaikuIntegration, QCocoaIntegration, and QAndroidPlatformIntegration.

Definition at line 87 of file qplatformintegration.cpp.

Here is the caller graph for this function:

◆ createEventDispatcher()

QAbstractEventDispatcher * QPlatformIntegration::createEventDispatcher ( ) const
pure virtual

Factory function for the GUI event dispatcher. The platform plugin should create and return a QAbstractEventDispatcher subclass when this function is called.

If the platform plugin for some reason creates the event dispatcher outside of this function (for example in the constructor), it needs to handle the case where this function is never called, ensuring that the event dispatcher is still deleted at some point (typically in the destructor).

Note that the platform plugin should never explicitly set the event dispatcher itself, using QCoreApplication::setEventDispatcher(), but let QCoreApplication decide when and which event dispatcher to create.

Since
5.2

Implemented in QXcbIntegration, QWindowsIntegration, QWasmIntegration, QVncIntegration, QVkKhrDisplayIntegration, QQnxIntegration, QOffscreenIntegration, QMinimalEglIntegration, QMinimalIntegration, QLinuxFbIntegration, QIOSIntegration, QIntegrityFbIntegration, QHaikuIntegration, QEglFSIntegration, QCocoaIntegration, QBsdFbIntegration, QAndroidPlatformIntegration, and QDirectFbIntegration.

Here is the caller graph for this function:

◆ createForeignWindow()

virtual QPlatformWindow* QPlatformIntegration::createForeignWindow ( QWindow ,
WId   
) const
inlinevirtual

Reimplemented in QXcbIntegration, QWindowsIntegration, QQnxIntegration, QCocoaIntegration, and QAndroidPlatformIntegration.

Definition at line 145 of file qplatformintegration.h.

Here is the caller graph for this function:

◆ createImagePaintEngine()

QPaintEngine * QPlatformIntegration::createImagePaintEngine ( QPaintDevice paintDevice) const
virtual

Factory function for QPaintEngine. This function will return 0 if the platform integration does not support creating any paint engine the given paintDevice.

Definition at line 338 of file qplatformintegration.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createPlatformBackingStore()

QPlatformBackingStore * QPlatformIntegration::createPlatformBackingStore ( QWindow window) const
pure virtual

Factory function for QPlatformBackingStore. The QWindow parameter is a pointer to the top level widget(tlw) the window surface is created for. A QPlatformWindow is always created before the QPlatformBackingStore for tlw where the widget also requires a backing store.

See also
QBackingStore
createPlatformWindow()

Implemented in QXcbIntegration, QWindowsGdiIntegration, QWasmIntegration, QVncIntegration, QVkKhrDisplayIntegration, QQnxIntegration, QOffscreenIntegration, QMinimalEglIntegration, QMinimalIntegration, QLinuxFbIntegration, QIOSIntegration, QIntegrityFbIntegration, QHaikuIntegration, QEglFSIntegration, QWindowsDirect2DIntegration, QBsdFbIntegration, QAndroidPlatformIntegration, QDirectFbIntegration, and QCocoaIntegration.

Here is the caller graph for this function:

◆ createPlatformOffscreenSurface()

QPlatformOffscreenSurface * QPlatformIntegration::createPlatformOffscreenSurface ( QOffscreenSurface surface) const
virtual

Factory function for QOffscreenSurface. An offscreen surface will typically be implemented with a pixel buffer (pbuffer). If the platform doesn't support offscreen surfaces, an invisible window will be used by QOffscreenSurface instead.

Reimplemented in QXcbIntegration, QWasmIntegration, QIOSIntegration, QEglFSIntegration, QCocoaIntegration, and QAndroidPlatformIntegration.

Definition at line 500 of file qplatformintegration.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createPlatformOpenGLContext()

QPlatformOpenGLContext * QPlatformIntegration::createPlatformOpenGLContext ( QOpenGLContext context) const
virtual

Factory function for QPlatformOpenGLContext. The context parameter is a pointer to the context for which a platform-specific context backend needs to be created. Configuration settings like the format, share context and screen have to be taken from this QOpenGLContext and the resulting platform context is expected to be backed by a native context that fulfills these criteria.

If the context has native handles set, no new native context is expected to be created. Instead, the provided handles have to be used. In this case the ownership of the handle must not be taken and the platform implementation is not allowed to destroy the native context. Configuration parameters like the format are also to be ignored. Instead, the platform implementation is responsible for querying the configuriation from the provided native context.

Returns a pointer to a QPlatformOpenGLContext instance or \nullptr if the context could not be created.

See also
QOpenGLContext

Reimplemented in QXcbIntegration, QWindowsIntegration, QWasmIntegration, QMinimalEglIntegration, QIOSIntegration, QEglFSIntegration, QCocoaIntegration, and QAndroidPlatformIntegration.

Definition at line 315 of file qplatformintegration.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createPlatformPixmap()

QPlatformPixmap * QPlatformIntegration::createPlatformPixmap ( QPlatformPixmap::PixelType  type) const
virtual

Factory function for QPlatformPixmap. PixelType can be either PixmapType or BitmapType.

See also
QPlatformPixmap

Reimplemented in QXcbIntegration, QWindowsGdiIntegration, QWindowsDirect2DIntegration, and QDirectFbIntegration.

Definition at line 290 of file qplatformintegration.cpp.

Here is the caller graph for this function:

◆ createPlatformSessionManager()

QPlatformSessionManager * QPlatformIntegration::createPlatformSessionManager ( const QString id,
const QString key 
) const
virtual
Since
5.2

Factory function for QPlatformSessionManager. The default QPlatformSessionManager provides the same functionality as the QSessionManager.

Definition at line 513 of file qplatformintegration.cpp.

Here is the caller graph for this function:

◆ createPlatformSharedGraphicsCache()

QPlatformSharedGraphicsCache * QPlatformIntegration::createPlatformSharedGraphicsCache ( const char *  cacheId) const
virtual

Factory function for QPlatformSharedGraphicsCache. This function will return 0 if the platform integration does not support any shared graphics cache mechanism for the given cacheId.

Definition at line 327 of file qplatformintegration.cpp.

◆ createPlatformTheme()

class QPlatformTheme * QPlatformIntegration::createPlatformTheme ( const QString name) const
virtual

Reimplemented in QXcbIntegration, QWindowsIntegration, QWasmIntegration, QVkKhrDisplayIntegration, QOffscreenIntegration, QIOSIntegration, QEglFSIntegration, QCocoaIntegration, and QAndroidPlatformIntegration.

Definition at line 489 of file qplatformintegration.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createPlatformWindow()

QPlatformWindow * QPlatformIntegration::createPlatformWindow ( QWindow window) const
pure virtual

Factory function for QPlatformWindow. The window parameter is a pointer to the window which the QPlatformWindow is supposed to be created for.

All windows have to have a QPlatformWindow, and it will be created on-demand when the QWindow is made visible for the first time, or explicitly through calling QWindow::create().

In the constructor, of the QPlatformWindow, the window flags, state, title and geometry of the window should be applied to the underlying window. If the resulting flags or state differs, the resulting values should be set on the window using QWindow::setWindowFlags() or QWindow::setWindowState(), respectively.

See also
QPlatformWindow, QPlatformWindowFormat
createPlatformBackingStore()

Implemented in QXcbIntegration, QWindowsIntegration, QWasmIntegration, QVncIntegration, QVkKhrDisplayIntegration, QQnxIntegration, QOffscreenIntegration, QMinimalEglIntegration, QMinimalIntegration, QLinuxFbIntegration, QIOSIntegration, QIntegrityFbIntegration, QHaikuIntegration, QEglFSIntegration, QCocoaIntegration, QBsdFbIntegration, QAndroidPlatformIntegration, and QDirectFbIntegration.

Here is the caller graph for this function:

◆ defaultWindowState()

Qt::WindowState QPlatformIntegration::defaultWindowState ( Qt::WindowFlags  flags) const
virtual

Reimplemented in QWasmIntegration, and QAndroidPlatformIntegration.

Definition at line 447 of file qplatformintegration.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ destroy()

void QPlatformIntegration::destroy ( )
virtual

Called before the platform integration is deleted. Useful when cleanup relies on virtual functions.

Since
5.5

Reimplemented in QEglFSIntegration.

Definition at line 362 of file qplatformintegration.cpp.

◆ fontDatabase()

QT_BEGIN_NAMESPACE QPlatformFontDatabase * QPlatformIntegration::fontDatabase ( ) const
virtual

◆ hasCapability()

bool QPlatformIntegration::hasCapability ( Capability  cap) const
virtual

◆ initialize()

void QPlatformIntegration::initialize ( )
virtual

Performs initialization steps that depend on having an event dispatcher available. Called after the event dispatcher has been created.

Tasks that require an event dispatcher, for example creating socket notifiers, cannot be performed in the constructor. Instead, they should be performed here. The default implementation does nothing.

Reimplemented in QXcbIntegration, QWindowsIntegration, QWasmIntegration, QVncIntegration, QVkKhrDisplayIntegration, QOffscreenIntegration, QLinuxFbIntegration, QIOSIntegration, QIntegrityFbIntegration, QEglFSIntegration, QBsdFbIntegration, and QAndroidPlatformIntegration.

Definition at line 352 of file qplatformintegration.cpp.

Here is the caller graph for this function:

◆ inputContext()

QPlatformInputContext * QPlatformIntegration::inputContext ( ) const
virtual

Returns the platforms input context.

The default implementation returns \nullptr, implying no input method support.

Reimplemented in QXcbIntegration, QWindowsIntegration, QWasmIntegration, QVncIntegration, QVkKhrDisplayIntegration, QOffscreenIntegration, QLinuxFbIntegration, QIOSIntegration, QIntegrityFbIntegration, QEglFSIntegration, QCocoaIntegration, QBsdFbIntegration, QAndroidPlatformIntegration, and QDirectFbIntegration.

Definition at line 371 of file qplatformintegration.cpp.

Here is the caller graph for this function:

◆ nativeInterface()

QPlatformNativeInterface * QPlatformIntegration::nativeInterface ( ) const
virtual

◆ openGLModuleType()

QOpenGLContext::OpenGLModuleType QPlatformIntegration::openGLModuleType ( )
virtual

Platform integration function for querying the OpenGL implementation type.

Used only when dynamic OpenGL implementation loading is enabled.

Subclasses should reimplement this function and return a value based on the OpenGL implementation they have chosen to load.

Note
The return value does not indicate or limit the types of contexts that can be created by a given implementation. For example a desktop OpenGL implementation may be capable of creating OpenGL ES-compatible contexts too.
See also
QOpenGLContext::openGLModuleType(), QOpenGLContext::isOpenGLES()
Since
5.3

Reimplemented in QWindowsIntegration.

Definition at line 576 of file qplatformintegration.cpp.

Here is the caller graph for this function:

◆ possibleKeys()

QList< int > QPlatformIntegration::possibleKeys ( const QKeyEvent ) const
virtual

Should be used to obtain a list of possible shortcuts for the given key event. Shortcuts should be encoded as int(Qt::Key + Qt::KeyboardModifiers).

One example for more than one possibility is the key combination of Shift+5. That one might trigger a shortcut which is set as "Shift+5" as well as one using %. These combinations depend on the currently set keyboard layout.

Note
This function should be called only from key event handlers.

Reimplemented in QCocoaIntegration, QXcbIntegration, and QWindowsIntegration.

Definition at line 479 of file qplatformintegration.cpp.

Here is the caller graph for this function:

◆ queryKeyboardModifiers()

Qt::KeyboardModifiers QPlatformIntegration::queryKeyboardModifiers ( ) const
virtual

Reimplemented in QXcbIntegration, QWindowsIntegration, and QCocoaIntegration.

Definition at line 464 of file qplatformintegration.cpp.

Here is the call graph for this function:

◆ quit()

void QPlatformIntegration::quit ( ) const
virtual
Since
6.0

Asks the platform to terminate the application.

Overrides should ensure there's a callback into the QWSI function handleApplicationTermination so that the quit can be propagated to QtGui and the application.

Reimplemented in QCocoaIntegration.

Definition at line 553 of file qplatformintegration.cpp.

Here is the caller graph for this function:

◆ services()

QPlatformServices * QPlatformIntegration::services ( ) const
virtual

◆ setApplicationIcon()

void QPlatformIntegration::setApplicationIcon ( const QIcon icon) const
virtual
Since
5.5

Platform integration function for setting the application icon.

See also
QGuiApplication::setWindowIcon()

Reimplemented in QCocoaIntegration.

Definition at line 590 of file qplatformintegration.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ styleHint()

QVariant QPlatformIntegration::styleHint ( StyleHint  hint) const
virtual

◆ sync()

void QPlatformIntegration::sync ( )
virtual
Since
5.2

Function to sync the platform integrations state with the window system.

This is often implemented as a roundtrip from the platformintegration to the window system.

This function should not call QWindowSystemInterface::flushWindowSystemEvents() or QCoreApplication::processEvents()

Reimplemented in QXcbIntegration.

Definition at line 529 of file qplatformintegration.cpp.

Here is the caller graph for this function:

◆ themeNames()

QStringList QPlatformIntegration::themeNames ( ) const
virtual

The documentation for this class was generated from the following files: