CopperSpice API  1.7.2
QPlatformIntegration Class Referenceabstract

Entry point for the WindowSystem specific functionality. More...

Public Types

enum  Capability
 

Public Methods

virtual QPlatformAccessibilityaccessibility () const
 
virtual QPlatformClipboardclipboard () const
 
virtual QAbstractEventDispatchercreateEventDispatcher () const = 0
 
virtual QPaintEnginecreateImagePaintEngine (QPaintDevice *paintDevice) const
 
virtual QPlatformBackingStorecreatePlatformBackingStore (QWindow *window) const = 0
 
virtual QPlatformOffscreenSurfacecreatePlatformOffscreenSurface (QOffscreenSurface *surface) const
 
virtual QPlatformOpenGLContextcreatePlatformOpenGLContext (QOpenGLContext *context) const
 
virtual QPlatformPixmapcreatePlatformPixmap (QPlatformPixmap::PixelType type) const
 
virtual QPlatformSessionManagercreatePlatformSessionManager (const QString &id, const QString &key) const
 
virtual QPlatformSharedGraphicsCachecreatePlatformSharedGraphicsCache (const char *cacheId) const
 
virtual QPlatformThemecreatePlatformTheme (const QString &name) const
 
virtual QPlatformWindowcreatePlatformWindow (QWindow *window) const = 0
 
virtual Qt::WindowState defaultWindowState (Qt::WindowFlags flags) const
 
virtual void destroy ()
 
virtual QPlatformDragdrag () const
 
virtual QPlatformFontDatabasefontDatabase () const
 
virtual bool hasCapability (Capability cap) const
 
virtual void initialize ()
 
virtual QPlatformInputContextinputContext () const
 
virtual QPlatformNativeInterfacenativeInterface () const
 
virtual QOpenGLContext::OpenGLModuleType openGLModuleType ()
 
virtual QList< int > possibleKeys (const QKeyEvent *event) const
 
virtual Qt::KeyboardModifiers queryKeyboardModifiers () const
 
void removeScreen (QScreen *screen)
 
virtual QPlatformServicesservices () const
 
virtual void setApplicationIcon (const QIcon &icon) const
 
virtual QVariant styleHint (StyleHint hint) const
 
virtual void sync ()
 
virtual QStringList themeNames () const
 

Protected Methods

void destroyScreen (QPlatformScreen *screen)
 
void screenAdded (QPlatformScreen *screen, bool isPrimary=false)
 
void setPrimaryScreen (QPlatformScreen *newPrimary)
 

Detailed Description

QPlatformIntegration is the single entry point for the window system specific functionality. This class contains various methods for creating platform specific functionality for areas such as fonts and text rendering. This class is a singleton which means it is only instantiated one time. This occurs in the QApplication constructor.

Every method in this class which starts with the word create allocates a new object which the caller is responsible for deleting. QPlatformIntegration does not take ownership of these objects.

Member Enumeration Documentation

Capabilities are used to determine specific features of a platform integration.

ValueDescription
ThreadedPixmaps Platform supports using a pixmap from multiple threads
OpenGL Platform supports OpenGL
ThreadedOpenGL Platform supports using OpenGL outside the main thread
SharedGraphicsCache Platform supports a shared graphics cache
BufferQueueingOpenGL
WindowMasks
MultipleWindows Platform supports multiple top level windows
ApplicationState
ForeignWindows Platform supports creating a QWindow to represent a native window
NonFullScreenWindows Platform supports top level windows which do not fill the screen
NativeWidgets
WindowManagement
SyncState
RasterGLSurface
AllGLFunctionsQueryable
ApplicationIcon Platform supports setting the application icon
SwitchableWidgetComposition

Method Documentation

QPlatformAccessibility * QPlatformIntegration::accessibility ( ) const
virtual

Returns the platforms accessibility. The default implementation returns a nullptr implying no accessibility support.

QPlatformClipboard * QPlatformIntegration::clipboard ( ) const
virtual

Return the platform clipboard. The default implementation returns a default QPlatformClipboard.

See also
QPlatformClipboard
QAbstractEventDispatcher * QPlatformIntegration::createEventDispatcher ( ) const
pure virtual

The is the factory method for the GUI event dispatcher. The platform plugin should create and return a QAbstractEventDispatcher subclass when this method is called. If the platform plugin creates the event dispatcher before this method is called, it also needs to handle the case where this method is never called. Ensure that even if this method is never called the event dispatcher is still destroyed.

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

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

The is the factory method for QPaintEngine. Returns a nullptr if the platform integration does not support creating any paint engine the given paintDevice.

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

The is the factory method or QPlatformBackingStore. The given window is a pointer to the top level widget surface. A QPlatformWindow is always created before the QPlatformBackingStore when one is required.

See also
QBackingStore, createPlatformWindow()
QPlatformOffscreenSurface * QPlatformIntegration::createPlatformOffscreenSurface ( QOffscreenSurface surface) const
virtual

The is the factory method for QOffscreenSurface. An offscreen surface will typically be implemented with a pixel buffer (pbuffer). If the platform does not support offscreen surfaces, an invisible window will be used by QOffscreenSurface instead.

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

The is the factory method for QPlatformOpenGLContext. The context parameter is a pointer which must be used to create a platform specific context backend. Configuration settings, like the format share context and screen, are taken from the QOpenGLContext. The resulting QPlatformOpenGLContext must contain a handle to a native OpenGL context.

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 confirmation from the provided native context.

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

See also
QOpenGLContext
QPlatformPixmap * QPlatformIntegration::createPlatformPixmap ( QPlatformPixmap::PixelType  type) const
virtual

The is the factory method for QPlatformPixmap. The value for type can be either PixmapType or BitmapType.

See also
QPlatformPixmap
QPlatformSessionManager * QPlatformIntegration::createPlatformSessionManager ( const QString id,
const QString key 
) const
virtual

The is the factory method for QPlatformSessionManager. The default QPlatformSessionManager provides the same functionality as the QSessionManager.

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

The is the factory method for QPlatformSharedGraphicsCache. This method will return a nullptr if the platform integration does not support any shared graphics cache mechanism for the given cacheId.

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

Sets the platform theme to the given name.

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

The is the factory method for QPlatformWindow. The window parameter is a pointer to the top level window which the QPlatformWindow is supposed to be created for.

All top level windows have to have a QPlatformWindow and it will be created when the QPlatformWindow is set to be visible for the first time. If the top level window's flags are changed, or if the top level window's QPlatformWindowFormat is changed, then the top level window's QPlatformWindow is deleted and a new one is created.

In the constructor of the QPlatformWindow the window flags, state, title and geometry of the given 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()
Qt::WindowState QPlatformIntegration::defaultWindowState ( Qt::WindowFlags  flags) const
virtual

Documentation pending.

void QPlatformIntegration::destroy ( )
virtual

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

void QPlatformIntegration::destroyScreen ( QPlatformScreen screen)
protected

This method removes the given screen from QApplication::screens() and deletes the screen. Failing to call this method and manually deleting the QPlatformScreen is undefined behavior.

QPlatformDrag * QPlatformIntegration::drag ( ) const
virtual

Documentation pending.

QPlatformFontDatabase * QPlatformIntegration::fontDatabase ( ) const
virtual

Returns the platform fontdatabase. The default implementation returns a default QPlatformFontDatabase.

See also
QPlatformFontDatabase
bool QPlatformIntegration::hasCapability ( Capability  cap) const
virtual

Returns true if the platform supports the given cap.

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, can not be performed in the constructor. Instead, they should be performed here. The default implementation does nothing.

QPlatformInputContext * QPlatformIntegration::inputContext ( ) const
virtual

Returns the platforms input context. The default implementation returns a nullptr implying no input method support.

QPlatformNativeInterface * QPlatformIntegration::nativeInterface ( ) const
virtual

Returns a pointer to the current QPlatformNativeInterface.

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.

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()
QList< int > QPlatformIntegration::possibleKeys ( const QKeyEvent event) const
virtual

Can be used to obtain a list of possible shortcuts for the given key event. For example, the key combination of Shift+5 might trigger a shortcut which is set as "Shift+5" as well as one using "%". These combinations depend on the currently set keyboard layout and must be handled by the platform integration.

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

Documentation pending.

void QPlatformIntegration::removeScreen ( QScreen screen)

Removes the given screen and then calls destroyScreen().

See also
destroyScreen()
void QPlatformIntegration::screenAdded ( QPlatformScreen screen,
bool  isPrimary = false 
)
protected

Should be called by the platform integration when a new screen is added. The first screen added will automatically be the primary screen which is used for default created windows, an OpenGL context, and other resources unless otherwise specified. If isPrimary is true the new screen becomes the primary screen.

Calling this methods adds the screen to QApplication::screens() and emits the QApplication::screenAdded() signal. The screen should be deleted by calling Interdenominational::destroyScreen().

QPlatformServices * QPlatformIntegration::services ( ) const
virtual

Documentation pending.

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

This is a platform integration method for setting the application icon.

See also
QApplication::setWindowIcon()
void QPlatformIntegration::setPrimaryScreen ( QPlatformScreen newPrimary)
protected

Should be called when the newPrimary screen changes. When the screen specified as primary changes, this method will notify QApplication and emit the QApplication::primaryScreenChanged signal.

QVariant QPlatformIntegration::styleHint ( StyleHint  hint) const
virtual

Documentation pending.

void QPlatformIntegration::sync ( )
virtual

This method synchronizes the platform integration state with the window system. This method should not call QWindowSystemInterface::flushWindowSystemEvents() or QCoreApplication::processEvents().

QStringList QPlatformIntegration::themeNames ( ) const
virtual

Documentation pending.