7#include <qpa/qplatformtheme.h>
9#include <QtCore/qsharedpointer.h>
10#include <QtCore/qvariant.h>
11#include <QtCore/qlist.h>
12#include <QtCore/qsize.h>
29#if QT_CONFIG(systemtrayicon)
41 {
return m_palettes[type]; }
43 {
return m_fonts[type]; }
47 QIcon fileIcon(
const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions = {})
const override;
70 void refreshPalettes();
72 void refreshIconPixmapSizes();
74 static void populateLightSystemBasePalette(QPalette &result);
75 static void populateDarkSystemBasePalette(QPalette &result);
77 static Qt::ColorScheme queryColorScheme();
78 static Qt::ColorScheme effectiveColorScheme();
88 QList<QSize> m_fileIconSizes;
90 HWND m_themeChangeObserver =
nullptr;
91 void destroyThemeChangeWindow();
\inmodule QtCore\reentrant
Base class for QWindowsForeignWindow, QWindowsWindow.
virtual bool isTopLevel() const
QMargins frameMargins_sys() const
bool isTopLevel_sys() const
void setHasBorderInFullScreen(bool border) override
QMargins customMargins() const override
bool windowEvent(QEvent *event) override
Reimplement this method to be able to do any platform specific event handling.
bool hasBorderInFullScreen() const override
static QWindowsBaseWindow * baseWindowOf(const QWindow *w)
bool hasMaximumWidth() const
virtual QMargins fullFrameMargins() const
QRect geometry() const override
Returns the current geometry of a window.
std::optional< TouchWindowTouchTypes > touchWindowTouchTypes_sys() const
static HWND handleOf(const QWindow *w)
QPoint mapToGlobal(const QPoint &pos) const override
Translates the window coordinate pos to global screen coordinates using native methods.
QMargins frameMargins() const override
QWindowsBaseWindow(QWindow *window)
bool hasMaximumHeight() const
static bool isRtlLayout(HWND hwnd)
QRect frameGeometry_sys() const
WId winId() const override
Reimplement in subclasses to return a handle to the native window.
QRect geometry_sys() const
virtual HWND handle() const =0
QPoint mapFromGlobal(const QPoint &pos) const override
Translates the global screen coordinate pos to window coordinates using native methods.
void setCustomMargins(const QMargins &margins) override
void setGeometry_sys(const QRect &rect) const
bool hasMaximumSize() const
void setWindowTitle_sys(const QString &title)
Singleton container for all relevant information.
QSharedPointer< QWindowCreationContext > windowCreationContext() const
QWindowsScreenManager & screenManager()
static QString classNamePrefix()
QWindowsWindow * findClosestPlatformWindow(HWND) const
QWindow * findWindow(HWND) const
void addWindow(HWND, QWindowsWindow *w)
static bool systemParametersInfoForScreen(unsigned action, unsigned param, void *out, const QPlatformScreen *screen=nullptr)
static DWORD readAdvancedExplorerSettings(const wchar_t *subKey, DWORD defaultValue)
void clearWindowUnderMouse()
HDC displayContext() const
static bool shouldHaveNonClientDpiScaling(const QWindow *window)
QWindowsTabletSupport * tabletSupport() const
static bool systemParametersInfoForWindow(unsigned action, unsigned param, void *out, const QPlatformWindow *win=nullptr)
QString registerWindowClass(const QWindow *w)
static void setTabletAbsoluteRange(int a)
static void forceNcCalcSize(HWND hwnd)
void registerTouchWindows()
QWindowsWindow * findPlatformWindowAt(HWND parent, const QPoint &screenPoint, unsigned cwex_flags) const
void setKeyGrabber(QWindow *hwnd)
static bool nonClientMetrics(NONCLIENTMETRICS *ncm, unsigned dpi=0)
bool initTouch(unsigned integrationOptions)
HWND createDummyWindow(const QString &classNameIn, const wchar_t *windowName, WNDPROC wndProc=nullptr, DWORD style=WS_OVERLAPPED)
Convenience to create a non-visible, message-only dummy window for example used as clipboard watcher ...
void setAsyncExpose(bool value)
QSharedPointer< QWindowCreationContext > setWindowCreationContext(const QSharedPointer< QWindowCreationContext > &ctx)
static QtWindows::DpiAwareness windowDpiAwareness(HWND hwnd)
static bool filterNativeEvent(MSG *msg, LRESULT *result)
unsigned systemInfo() const
static QtWindows::DpiAwareness processDpiAwareness()
QWindowsWindow * findPlatformWindow(HWND) const
QWindow * keyGrabber() const
QWindowsWindow * findPlatformWindow(const QWindowsMenuBar *mb) const
QWindow * windowUnderMouse() const
QPlatformKeyMapper * keyMapper() const
bool useRTLExtensions() const
static bool systemParametersInfo(unsigned action, unsigned param, void *out, unsigned dpi=0)
QWindowsMimeRegistry & mimeConverter() const
static bool nonClientMetricsForWindow(NONCLIENTMETRICS *ncm, const QPlatformWindow *win=nullptr)
static bool isSessionLocked()
bool initPowerNotificationHandler()
HandleBaseWindowHash & windows()
static QWindowsContext * instance()
QString registerWindowClass(QString cname, WNDPROC proc, unsigned style=0, HBRUSH brush=nullptr, bool icon=false)
static bool filterNativeEvent(QWindow *window, MSG *msg, LRESULT *result)
static bool nonClientMetricsForScreen(NONCLIENTMETRICS *ncm, const QPlatformScreen *screen=nullptr)
void setDetectAltGrModifier(bool a)
Platform cursor implementation.
static bool hasOverrideCursor()
static QPoint mousePosition()
void setOverrideCursor(const QCursor &cursor) override
Reimplement this function in subclass to set an override cursor on the associated screen and return t...
static HCURSOR createPixmapCursor(const PixmapCursor &pc, qreal scaleFactor=1)
static HCURSOR createPixmapCursor(QPixmap pixmap, const QPoint &hotSpot, qreal scaleFactor=1)
void changeCursor(QCursor *widgetCursor, QWindow *widget) override
Set a cursor on a window.
static PixmapCursor customCursor(Qt::CursorShape cursorShape, const QPlatformScreen *screen=nullptr)
HCURSOR hCursor(const QCursor &c) const
void clearOverrideCursor() override
Reimplement this function in subclass to clear the override cursor.
CursorHandlePtr standardWindowCursor(Qt::CursorShape s=Qt::ArrowCursor)
Return cached standard cursor resources or create new ones.
static State cursorState()
static HCURSOR createCursorFromShape(Qt::CursorShape cursorShape, const QPlatformScreen *screen=nullptr)
static void enforceOverrideCursor()
QWindowsCursor(const QPlatformScreen *screen)
QPixmap dragDefaultCursor(Qt::DropAction action) const
CursorHandlePtr pixmapWindowCursor(const QCursor &c)
Return cached pixmap cursor or create new one.
QSize size() const override
Returns the size of the cursor, in native pixels.
QPoint pos() const override
void setPos(const QPoint &pos) override
Window wrapping GetDesktopWindow not allowing any manipulation.
HWND handle() const override
QMargins frameMargins() const override
QWindowsDesktopWindow(QWindow *window)
bool isTopLevel() const override
Window wrapping a foreign native window.
void setGeometry(const QRect &rect) override
This function is called by Qt whenever a window is moved or resized using the QWindow API.
bool isForeignWindow() const override
HWND handle() const override
void lower() override
Reimplement to be able to let Qt lower windows to the bottom of the desktop.
void setVisible(bool visible) override
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false.
void setParent(const QPlatformWindow *window) override
This function is called to enable native child window in QPA.
void setWindowTitle(const QString &title) override
Reimplement to set the window title to title.
QWindowsForeignWindow(QWindow *window, HWND hwnd)
void raise() override
Reimplement to be able to let Qt raise windows to the top of the desktop.
static QWindowsStaticOpenGLContext * staticOpenGLContext()
Manages the list of QWindowsMimeConverter instances.
Provides access to native handles.
void * nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override
void * nativeResourceForWindow(const QByteArray &resource, QWindow *window) override
void * nativeResourceForCursor(const QByteArray &resource, const QCursor &cursor) override
void * nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override
Implementation of IDropTarget.
Manages a list of QWindowsScreen.
bool handleScreenChanges()
Synchronizes the screen list, adds new screens, removes deleted ones and propagates resolution change...
const QWindowsScreen * screenForHwnd(HWND hwnd) const
const WindowsScreenList & screens() const
static bool isSingleScreen()
qreal refreshRate() const override
Reimplement this function in subclass to return the vertical refresh rate of the screen,...
QString serialNumber() const override
Reimplement this function in subclass to return the serial number of this screen.
QDpi logicalDpi() const override
Reimplement this function in subclass to return the logical horizontal and vertical dots per inch met...
QList< QPlatformScreen * > virtualSiblings() const override
Determine siblings in a virtual desktop system.
Qt::ScreenOrientation orientation() const override
Reimplement this function in subclass to return the current orientation of the screen,...
QPlatformCursor * cursor() const override
Reimplement this function in subclass to return the cursor of the screen.
QPixmap grabWindow(WId window, int qX, int qY, int qWidth, int qHeight) const override
This function is called when Qt needs to be able to grab the content of a window.
QRect geometry() const override
Reimplement in subclass to return the pixel geometry of the screen.
qreal devicePixelRatio() const override
Reimplement this function in subclass to return the device pixel ratio for the screen.
const CursorPtr & cursorPtr() const
QPlatformScreen::SubpixelAntialiasingType subpixelAntialiasingTypeHint() const override
Queries ClearType settings to check the pixel layout.
static bool setOrientationPreference(Qt::ScreenOrientation o)
QRect availableGeometry() const override
Reimplement in subclass to return the pixel geometry of the available space This normally is the desk...
QString name() const override
QString manufacturer() const override
Reimplement this function in subclass to return the manufacturer of this screen.
QString model() const override
Reimplement this function in subclass to return the model of this screen.
QDpi logicalBaseDpi() const override
Reimplement to return the base logical DPI for the platform.
HMONITOR handle() const override
int depth() const override
Reimplement in subclass to return current depth of the screen.
QSizeF physicalSize() const override
Reimplement this function in subclass to return the physical size of the screen, in millimeters.
const QWindowsScreenData & data() const
QImage::Format format() const override
Reimplement in subclass to return the image format which corresponds to the screen format.
static Qt::ScreenOrientation orientationPreference()
virtual ~QWindowsStaticOpenGLContext()=default
virtual void * createWindowSurface(void *, void *, int *)
virtual QOpenGLContext::OpenGLModuleType moduleType() const =0
QWindowsStaticOpenGLContext()=default
virtual void * moduleHandle() const =0
virtual QWindowsOpenGLContext * createContext(HGLRC context, HWND window)=0
virtual void destroyWindowSurface(void *)
virtual QWindowsOpenGLContext * createContext(QOpenGLContext *context)=0
virtual bool supportsThreadedOpenGL() const
Tablet support for Windows.
static bool useNativeMenus()
void requestColorScheme(Qt::ColorScheme scheme) override
void showPlatformMenuBar() override
QIconEngine * createIconEngine(const QString &iconName) const override
Factory function for the QIconEngine used by QIcon::fromTheme().
QPlatformMenuBar * createPlatformMenuBar() const override
static void handleThemeChange()
bool usePlatformNativeDialog(DialogType type) const override
const QFont * font(Font type=SystemFont) const override
QList< QSize > availableFileIconSizes() const
QPlatformMenuItem * createPlatformMenuItem() const override
const QPalette * palette(Palette type=SystemPalette) const override
Return a color palette for type type.
Qt::ColorScheme colorScheme() const override
static QPalette systemPalette(Qt::ColorScheme)
QVariant themeHint(ThemeHint) const override
~QWindowsTheme() override
static bool queryHighContrast()
QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions={}) const override
Return an icon for fileInfo, observing iconOptions.
QPlatformDialogHelper * createPlatformDialogHelper(DialogType type) const override
static QWindowsTheme * instance()
QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const override
Return a pixmap for standardPixmap, at the given size.
QPlatformMenu * createPlatformMenu() const override
Qt::ContrastPreference contrastPreference() const override
bool handleNonClientHitTest(const QPoint &globalPos, LRESULT *result) const
void alertWindow(int durationMs=0)
void setWindowFlags(Qt::WindowFlags flags) override
Requests setting the window flags of this surface to flags.
void setCustomMargins(const QMargins &m) override
Sets custom margins to be added to the default margins determined by the windows style in the handlin...
void setMenuBar(QWindowsMenuBar *mb)
static QWindowsWindow * windowsWindowOf(const QWindow *w)
void invalidateSurface() override
Invalidates the window's surface by releasing its surface buffers.
HDC getDC()
Allocates a HDC for the window or returns the temporary one obtained from WinAPI BeginPaint within a ...
QMargins fullFrameMargins() const override
void initialize() override
Called as part of QWindow::create(), after constructing the window.
void handleDpiChangedAfterParent(HWND hwnd)
static void setHasBorderInFullScreenStatic(QWindow *window, bool border)
void checkForScreenChanged(ScreenChangeMode mode=FromGeometryChange)
void requestUpdate() override
Requests an QEvent::UpdateRequest event.
bool testFlag(unsigned f) const
static QString formatWindowTitle(const QString &title)
void setFlag(unsigned f) const
void clearFlag(unsigned f) const
void setFrameStrutEventsEnabled(bool enabled) override
Reimplement this method to set whether frame strut events should be sent to enabled.
static void settingsChanged()
static bool handleGeometryChangingMessage(MSG *message, const QWindow *qWindow, const QMargins &marginsDp)
void getSizeHints(MINMAXINFO *mmi) const
static void setHasBorderInFullScreenDefault(bool border)
~QWindowsWindow() override
bool handleWmPaint(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result)
void setParent(const QPlatformWindow *window) override
This function is called to enable native child window in QPA.
static bool hasNoNativeFrame(HWND hwnd, Qt::WindowFlags flags)
QRect restoreGeometry() const
static void * userDataOf(HWND hwnd)
bool setMouseGrabEnabled(bool grab) override
void propagateSizeHints() override
Reimplement to propagate the size hints of the QWindow.
static void setUserDataOf(HWND hwnd, void *ud)
void applyCursor()
Applies to cursor property set on the window to the global cursor.
bool isExposed() const override
Returns if this window is exposed in the windowing system.
bool handleGeometryChanging(MSG *message) const
bool isActive() const override
Returns true if the window should appear active from a style perspective.
void setStyle(unsigned s) const
static QScreen * forcedScreenForGLWindow(const QWindow *w)
QString windowTitle() const override
Reimplement to return the actual window title used in the underlying windowing system unless the titl...
static void displayChanged()
bool setKeyboardGrabEnabled(bool grab) override
static bool setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal opacity)
void raise() override
Reimplement to be able to let Qt raise windows to the top of the desktop.
bool windowEvent(QEvent *event) override
Reimplement this method to be able to do any platform specific event handling.
void setGeometry(const QRect &rect) override
This function is called by Qt whenever a window is moved or resized using the QWindow API.
void setEnabled(bool enabled)
void setVisible(bool visible) override
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false.
QSurfaceFormat format() const override
Returns the actual surface format of the window.
static const char * embeddedNativeParentHandleProperty
QWindowsMenuBar * menuBar() const
void handleDpiChanged(HWND hwnd, WPARAM wParam, LPARAM lParam)
void registerTouchWindow()
QMargins frameMargins() const override
void setWindowIcon(const QIcon &icon) override
Reimplement to set the window icon to icon.
bool isClientAreaExpanded() const
void handleResized(int wParam, LPARAM lParam)
void setOpacity(qreal level) override
Reimplement to be able to let Qt set the opacity level of a window.
bool isEmbedded() const override
Returns true if the window is a child of a non-Qt window.
QMargins customMargins() const override
bool handleNonClientActivate(LRESULT *result) const
bool isAncestorOf(const QPlatformWindow *child) const override
Returns true if the window is an ancestor of the given child.
QRect normalGeometry() const override
Returns the geometry of a window in 'normal' state (neither maximized, fullscreen nor minimized) for ...
void setExStyle(unsigned s) const
qreal dpiRelativeScale(const UINT dpi) const
QMargins safeAreaMargins() const override
The safe area margins of a window represent the area that is safe to place content within,...
void setSavedDpi(int dpi)
void requestActivateWindow() override
Reimplement to let Qt be able to request activation/focus for a window.
static QWindow * topLevelOf(QWindow *w)
void handleDpiScaledSize(WPARAM wParam, LPARAM lParam, LRESULT *result)
static bool setDarkBorderToWindow(HWND hwnd, bool d)
void updateFullFrameMargins()
QRect geometry() const override
Returns the current geometry of a window.
bool frameStrutEventsEnabled() const override
Reimplement this method to return whether frame strut events are enabled.
@ SynchronousGeometryChangeEvent
@ OpenGlPixelFormatInitialized
@ WithinSetParent
Automatic mouse capture on button press.
@ DisableNonClientScaling
@ FrameStrutEventsEnabled
QPoint mapToGlobal(const QPoint &pos) const override
Translates the window coordinate pos to global screen coordinates using native methods.
static const char * hasBorderInFullScreenProperty
bool startSystemMove() override
Reimplement this method to start a system move operation if the system supports it and return true to...
bool isTopLevel() const override
void releaseDC()
Releases the HDC for the window or does nothing in case it was obtained from WinAPI BeginPaint within...
void lower() override
Reimplement to be able to let Qt lower windows to the bottom of the desktop.
void updateRestoreGeometry()
void setWindowState(Qt::WindowStates state) override
Requests setting the window state of this surface to type.
void setCursor(const CursorHandlePtr &c)
void updateCustomTitlebar()
bool hasBorderInFullScreen() const override
bool hasMouseCapture() const
void * surface(void *nativeConfig, int *err)
void setHasBorderInFullScreen(bool border) override
QPoint mapFromGlobal(const QPoint &pos) const override
Translates the global screen coordinate pos to window coordinates using native methods.
CursorHandlePtr cursor() const
void handleCompositionSettingsChanged()
void setWindowTitle(const QString &title) override
Reimplement to set the window title to title.
void setDarkBorder(bool d)
QWindowsWindow(QWindow *window, const QWindowsWindowData &data)
bool startSystemResize(Qt::Edges edges) override
Reimplement this method to start a system resize operation if the system supports it and return true ...
void setFullFrameMargins(const QMargins &newMargins)
void setMask(const QRegion ®ion) override
Reimplement to be able to let Qt set the mask of a window.
void setAlertState(bool enabled) override
Reimplement this method to set whether the window demands attention (for example, by flashing the tas...
HWND handle() const override
bool isAlertState() const override
Reimplement this method return whether the window is in an alert state.
#define WM_GETDPISCALEDSIZE
#define WM_SYSCOLORCHANGE
#define WM_DWMCOMPOSITIONCHANGED
#define WM_NCPOINTERUPDATE
#define WM_POINTERACTIVATE
#define WM_DWMCOLORIZATIONCOLORCHANGED
bool operator==(const QWindowsPixmapCursorCacheKey &k1, const QWindowsPixmapCursorCacheKey &k2)
size_t qHash(const QWindowsPixmapCursorCacheKey &k, size_t seed) noexcept
static void clientToScreen(HWND hwnd, POINT *wP)
static void screenToClient(HWND hwnd, POINT *wP)
Active Context for creating windows.
QWindowCreationContext(const QWindow *w, const QScreen *s, const QRect &geometryIn, const QRect &geometry, const QMargins &customMargins, DWORD style, DWORD exStyle)
void applyToMinMaxInfo(MINMAXINFO *mmi) const
QRect requestedGeometryIn
PixmapCursor(const QPixmap &pix=QPixmap(), const QPoint &h=QPoint())
Stores geometry constraints and provides utility functions.
static QMargins frameOnPrimaryScreen(const QWindow *w, DWORD style, DWORD exStyle)
static QMargins frame(const QWindow *w, HWND hwnd)
static QMargins frame(const QWindow *w, const QRect &geometry, DWORD style, DWORD exStyle)
static QMargins frameOnPrimaryScreen(const QWindow *w, HWND hwnd)
static bool positionIncludesFrame(const QWindow *w)
static bool handleCalculateSize(const QWindow *window, const QMargins &customMargins, const MSG &msg, LRESULT *result)
static QPoint mapToGlobal(const QWindow *w, const QPoint &)
static QMargins frame(const QWindow *w, DWORD style, DWORD exStyle, qreal dpi)
static QPoint mapToGlobal(HWND hwnd, const QPoint &)
static QPoint mapFromGlobal(const HWND hwnd, const QPoint &)
static QPoint mapFromGlobal(const QWindow *w, const QPoint &)
static void applyToMinMaxInfo(const QWindow *w, const QMargins &margins, MINMAXINFO *mmi)
static void applyToMinMaxInfo(const QWindow *w, const QScreen *screen, const QMargins &margins, MINMAXINFO *mmi)
QWindowsPixmapCursorCacheKey(const QCursor &c, qreal scaleFactor)
QMargins fullFrameMargins
static QWindowsWindowData create(const QWindow *w, const QWindowsWindowData ¶meters, const QString &title)