![]() |
Qt 6.x
The Qt SDK
|
QPlatformIntegration implementation for Windows. More...
#include <qwindowsintegration.h>
Public Member Functions | |
QWindowsIntegration (const QStringList ¶mList) | |
~QWindowsIntegration () override | |
bool | hasCapability (QPlatformIntegration::Capability cap) const override |
QPlatformWindow * | createPlatformWindow (QWindow *window) const override |
Factory function for QPlatformWindow. | |
QPlatformWindow * | createForeignWindow (QWindow *window, WId nativeHandle) const override |
QPlatformOpenGLContext * | createPlatformOpenGLContext (QOpenGLContext *context) const override |
Factory function for QPlatformOpenGLContext. | |
QOpenGLContext::OpenGLModuleType | openGLModuleType () override |
Platform integration function for querying the OpenGL implementation type. | |
HMODULE | openGLModuleHandle () const override |
QOpenGLContext * | createOpenGLContext (HGLRC context, HWND window, QOpenGLContext *shareContext) const override |
QAbstractEventDispatcher * | createEventDispatcher () const override |
Factory function for the GUI event dispatcher. | |
void | initialize () override |
Performs initialization steps that depend on having an event dispatcher available. | |
QPlatformInputContext * | inputContext () const override |
Returns the platforms input context. | |
QPlatformFontDatabase * | fontDatabase () const override |
Accessor for the platform integration's fontdatabase. | |
QStringList | themeNames () const override |
QPlatformTheme * | createPlatformTheme (const QString &name) const override |
QPlatformServices * | services () const override |
QVariant | styleHint (StyleHint hint) const override |
Qt::KeyboardModifiers | queryKeyboardModifiers () const override |
QList< int > | possibleKeys (const QKeyEvent *e) const override |
Should be used to obtain a list of possible shortcuts for the given key event. | |
unsigned | options () const |
void | beep () const override |
void | setApplicationBadge (qint64 number) override |
void | setApplicationBadge (const QImage &image) |
void | updateApplicationBadge () |
![]() | |
virtual | ~QPlatformIntegration () |
virtual bool | hasCapability (Capability cap) const |
virtual QPlatformPixmap * | createPlatformPixmap (QPlatformPixmap::PixelType type) const |
Factory function for QPlatformPixmap. | |
virtual QPlatformWindow * | createPlatformWindow (QWindow *window) const =0 |
Factory function for QPlatformWindow. | |
virtual QPlatformWindow * | createForeignWindow (QWindow *, WId) const |
virtual QPlatformBackingStore * | createPlatformBackingStore (QWindow *window) const =0 |
Factory function for QPlatformBackingStore. | |
virtual QPlatformOpenGLContext * | createPlatformOpenGLContext (QOpenGLContext *context) const |
Factory function for QPlatformOpenGLContext. | |
virtual QPlatformSharedGraphicsCache * | createPlatformSharedGraphicsCache (const char *cacheId) const |
Factory function for QPlatformSharedGraphicsCache. | |
virtual QPaintEngine * | createImagePaintEngine (QPaintDevice *paintDevice) const |
Factory function for QPaintEngine. | |
virtual QAbstractEventDispatcher * | createEventDispatcher () const =0 |
Factory function for the GUI event dispatcher. | |
virtual void | initialize () |
Performs initialization steps that depend on having an event dispatcher available. | |
virtual void | destroy () |
Called before the platform integration is deleted. | |
virtual QPlatformFontDatabase * | fontDatabase () const |
Accessor for the platform integration's fontdatabase. | |
virtual QPlatformClipboard * | clipboard () const |
Accessor for the platform integration's clipboard. | |
virtual QPlatformInputContext * | inputContext () const |
Returns the platforms input context. | |
virtual QPlatformNativeInterface * | nativeInterface () const |
virtual QPlatformServices * | services () 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 |
Should be used to obtain a list of possible shortcuts for the given key event. | |
virtual QStringList | themeNames () const |
virtual QPlatformTheme * | createPlatformTheme (const QString &name) const |
virtual QPlatformOffscreenSurface * | createPlatformOffscreenSurface (QOffscreenSurface *surface) const |
Factory function for QOffscreenSurface. | |
virtual QPlatformSessionManager * | createPlatformSessionManager (const QString &id, const QString &key) const |
virtual void | sync () |
virtual QOpenGLContext::OpenGLModuleType | openGLModuleType () |
Platform integration function for querying the OpenGL implementation type. | |
virtual void | setApplicationIcon (const QIcon &icon) const |
virtual void | setApplicationBadge (qint64 number) |
virtual void | beep () const |
virtual void | quit () const |
template<auto func, typename... Args> | |
auto | call (Args... args) |
![]() | |
void | setTouchWindowTouchType (TouchWindowTouchTypes type) override |
TouchWindowTouchTypes | touchWindowTouchType () const override |
WindowActivationBehavior | windowActivationBehavior () const override |
void | setWindowActivationBehavior (WindowActivationBehavior behavior) override |
void | setHasBorderInFullScreenDefault (bool border) override |
bool | isTabletMode () const override |
bool | isWinTabEnabled () const override |
bool | setWinTabEnabled (bool enabled) override |
bool | isDarkMode () const override |
DarkModeHandling | darkModeHandling () const override |
void | setDarkModeHandling (DarkModeHandling handling) override |
void | registerMime (QWindowsMimeConverter *mime) override |
void | unregisterMime (QWindowsMimeConverter *mime) override |
int | registerMimeType (const QString &mime) override |
HWND | createMessageWindow (const QString &classNameTemplate, const QString &windowName, QFunctionPointer eventProc=nullptr) const override |
bool | asyncExpose () const override |
void | setAsyncExpose (bool value) override |
QVariant | gpu () const override |
QVariant | gpuList () const override |
void | populateLightSystemPalette (QPalette &palette) const override |
Static Public Member Functions | |
static QWindowsStaticOpenGLContext * | staticOpenGLContext () |
static QWindowsIntegration * | instance () |
Protected Member Functions | |
virtual QWindowsWindow * | createPlatformWindowHelper (QWindow *window, const QWindowsWindowData &) const |
![]() | |
QPlatformIntegration ()=default | |
QPlatformIntegration implementation for Windows.
The platform plugin should run on Desktop Windows from Windows XP onwards and Windows Embedded.
It should compile with: \list
Q_CC_MSVC
). Q_CC_MINGW
). This version ships with headers that are missing a lot of WinAPI. Q_CC_MINGW
and __MINGW64_VERSION_MAJOR
indicating the version). MinGW-w64 provides more complete headers (compared to stock MinGW from mingw.org), including a considerable part of the Windows SDK. \endlist Definition at line 25 of file qwindowsintegration.h.
Definition at line 33 of file qwindowsintegration.h.
|
explicit |
Definition at line 265 of file qwindowsintegration.cpp.
References DetectAltGrModifier, QWindowsScreenManager::initialize(), QWindowsIntegrationPrivate::m_context, QWindowsIntegrationPrivate::m_options, QWindowsIntegrationPrivate::parseOptions(), QWindowsContext::screenManager(), and QWindowsContext::setDetectAltGrModifier().
|
override |
Definition at line 277 of file qwindowsintegration.cpp.
|
overridevirtual |
Should sound a bell, using the default volume and sound.
Reimplemented from QPlatformIntegration.
Definition at line 637 of file qwindowsintegration.cpp.
|
overridevirtual |
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.
Implements QPlatformIntegration.
Definition at line 615 of file qwindowsintegration.cpp.
|
overridevirtual |
Reimplemented from QPlatformIntegration.
Definition at line 367 of file qwindowsintegration.cpp.
References Qt::dec(), Qt::hex(), Qt::noshowbase(), qCDebug, qWarning, screen, Qt::showbase(), and window().
|
override |
Definition at line 475 of file qwindowsintegration.cpp.
References context, QWindowsStaticOpenGLContext::createContext(), QOpenGLContextPrivate::get(), staticOpenGLContext(), and window().
|
overridevirtual |
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.
Reimplemented from QPlatformIntegration.
Definition at line 445 of file qwindowsintegration.cpp.
References context, QWindowsStaticOpenGLContext::createContext(), qCDebug, and staticOpenGLContext().
|
overridevirtual |
Reimplemented from QPlatformIntegration.
Definition at line 625 of file qwindowsintegration.cpp.
References QPlatformIntegration::createPlatformTheme(), and QWindowsTheme::name.
|
overridevirtual |
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.
Implements QPlatformIntegration.
Definition at line 320 of file qwindowsintegration.cpp.
References QWindowsWindowData::create(), createPlatformWindowHelper(), QWindowsWindowData::customMargins, Qt::dec(), Qt::Desktop, QWindowsWindow::DisableNonClientScaling, QWindowsWindowData::flags, QWindowsWindow::formatWindowTitle(), Qt::FramelessWindowHint, QWindowsWindowData::fullFrameMargins, QWindowsWindowData::geometry, Qt::hex(), QWindowsWindowData::hwnd, QVariant::isValid(), QWindowsMenuBar::menuBarOf(), Qt::noshowbase(), QWindowsGeometryHint::positionIncludesFrame(), Q_ASSERT, Q_UNLIKELY, qCDebug, QWindowsContext::shouldHaveNonClientDpiScaling(), Qt::showbase(), QHighDpi::toNativeLocalPosition(), QHighDpi::toNativePixels(), and window().
|
protectedvirtual |
Reimplemented in QWindowsDirect2DIntegration.
Definition at line 387 of file qwindowsintegration.cpp.
References window().
Referenced by createPlatformWindow().
|
overridevirtual |
Accessor for the platform integration's fontdatabase.
Default implementation returns a default QPlatformFontDatabase.
Reimplemented from QPlatformIntegration.
Definition at line 507 of file qwindowsintegration.cpp.
References FontDatabaseDirectWrite, FontDatabaseFreeType, QWindowsIntegrationPrivate::m_fontDatabase, and QWindowsIntegrationPrivate::m_options.
|
overridevirtual |
Reimplemented from QPlatformIntegration.
Definition at line 289 of file qwindowsintegration.cpp.
References QPlatformIntegration::AllGLFunctionsQueryable, QPlatformIntegration::ForeignWindows, QPlatformIntegration::hasCapability(), QPlatformIntegration::MultipleWindows, QPlatformIntegration::OpenGL, QPlatformIntegration::RasterGLSurface, staticOpenGLContext(), QPlatformIntegration::SwitchableWidgetComposition, QPlatformIntegration::ThreadedOpenGL, QPlatformIntegration::ThreadedPixmaps, and QPlatformIntegration::WindowMasks.
|
overridevirtual |
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 from QPlatformIntegration.
Definition at line 282 of file qwindowsintegration.cpp.
References QPlatformInputContextFactory::create(), QString::isNull(), QWindowsIntegrationPrivate::m_inputContext, QPlatformInputContextFactory::requested(), and QScopedPointer< T, Cleanup >::reset().
|
overridevirtual |
Returns the platforms input context.
The default implementation returns \nullptr, implying no input method support.
Reimplemented from QPlatformIntegration.
Definition at line 591 of file qwindowsintegration.cpp.
References QScopedPointer< T, Cleanup >::data(), and QWindowsIntegrationPrivate::m_inputContext.
|
inlinestatic |
Definition at line 88 of file qwindowsintegration.h.
Referenced by QWindowsGLContext::QWindowsGLContext(), QWindowsDialogs::createHelper(), doUseNativeMenus(), WindowCreationData::fromWindow(), QWindowsContext::initTouch(), QWindowsDirect2DIntegration::instance(), QWindowsDrag::instance(), QWindowsWindow::registerTouchWindow(), QWindowsWindow::requestActivateWindow(), shouldApplyDarkFrame(), staticOpenGLContext(), QWindowsMouseHandler::translateMouseEvent(), QWindowsPointerHandler::translateMouseEvent(), QWindowsDialogs::useHelper(), windowsInputContext(), and QWindowsContext::windowsProc().
|
override |
Definition at line 467 of file qwindowsintegration.cpp.
References QWindowsStaticOpenGLContext::moduleHandle(), and staticOpenGLContext().
|
overridevirtual |
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.
Reimplemented from QPlatformIntegration.
Definition at line 456 of file qwindowsintegration.cpp.
References QOpenGLContext::LibGL, QWindowsStaticOpenGLContext::moduleType(), and staticOpenGLContext().
unsigned QWindowsIntegration::options | ( | ) | const |
Definition at line 603 of file qwindowsintegration.cpp.
References QWindowsIntegrationPrivate::m_options.
Referenced by QWindowsGLContext::QWindowsGLContext(), doUseNativeMenus(), WindowCreationData::fromWindow(), and QWindowsMouseHandler::translateMouseEvent().
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.
Reimplemented from QPlatformIntegration.
Definition at line 573 of file qwindowsintegration.cpp.
References e, QWindowsIntegrationPrivate::m_context, and QWindowsContext::possibleKeys().
|
overridevirtual |
Reimplemented from QPlatformIntegration.
Definition at line 568 of file qwindowsintegration.cpp.
References QWindowsKeyMapper::queryKeyboardModifiers().
|
overridevirtual |
Reimplemented from QPlatformIntegration.
Definition at line 632 of file qwindowsintegration.cpp.
References QWindowsIntegrationPrivate::m_services.
Definition at line 745 of file qwindowsintegration.cpp.
References QGuiApplication::topLevelWindows().
Should set the application's badge to number.
If the number is 0 the badge should be cleared.
Reimplemented from QPlatformIntegration.
Definition at line 642 of file qwindowsintegration.cpp.
References QRect::adjust(), Qt::AlignCenter, QPainter::Antialiasing, Qt::black, QOperatingSystemVersion::current(), QFont::DemiBold, QPainter::drawEllipse(), QPainter::drawText(), QPainter::end(), QPainter::font(), font, QImage::Format_ARGB32_Premultiplied, QWindowsContext::isDarkMode(), QWindowsApplication::isDarkMode(), QColor::isValid(), QFont::Medium, Qt::NoPen, number, QString::number(), painter, qApp, qCeil(), qMax(), qt_win_hasPackageIdentity(), QColor::setAlphaF(), setApplicationBadge(), QPainter::setBrush(), QPainter::setFont(), QPainter::setPen(), QFont::setPixelSize(), QPainter::setRenderHint(), settings, QFont::setWeight(), text, QPainter::TextAntialiasing, QPainter::translate(), Qt::transparent, Qt::white, and QOperatingSystemVersion::Windows11.
Referenced by setApplicationBadge(), and updateApplicationBadge().
|
static |
Definition at line 494 of file qwindowsintegration.cpp.
References QWindowsStaticOpenGLContext::create(), d, QScopedPointer< T, Cleanup >::data(), instance(), and lock.
Referenced by createOpenGLContext(), createPlatformOpenGLContext(), hasCapability(), QWindowsWindow::invalidateSurface(), QWindowsNativeInterface::nativeResourceForIntegration(), openGLModuleHandle(), openGLModuleType(), and QWindowsWindow::surface().
|
overridevirtual |
Reimplemented from QPlatformIntegration.
Definition at line 535 of file qwindowsintegration.cpp.
References QPlatformIntegration::CursorFlashTime, QPlatformIntegration::FontSmoothingGamma, QWindowsFontDatabase::fontSmoothingGamma(), hint(), QPlatformIntegration::KeyboardAutoRepeatRate, QPlatformIntegration::KeyboardInputInterval, QWindowsIntegrationPrivate::m_context, QPlatformIntegration::MouseDoubleClickInterval, QPlatformIntegration::PasswordMaskDelay, QPlatformIntegration::ShowIsFullScreen, QPlatformIntegration::ShowIsMaximized, QPlatformIntegration::StartDragDistance, QPlatformIntegration::StartDragTime, QPlatformIntegration::StartDragVelocity, QPlatformIntegration::styleHint(), QPlatformIntegration::UseRtlExtensions, and QWindowsContext::useRTLExtensions().
|
overridevirtual |
Reimplemented from QPlatformIntegration.
Definition at line 620 of file qwindowsintegration.cpp.
References QWindowsTheme::name.
void QWindowsIntegration::updateApplicationBadge | ( | ) |
Definition at line 782 of file qwindowsintegration.cpp.
References setApplicationBadge().
Referenced by QWindowsContext::windowsProc().