Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwindowswindow.h
Go to the documentation of this file.
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#ifndef QWINDOWSWINDOW_H
5#define QWINDOWSWINDOW_H
6
7#include <QtCore/qt_windows.h>
8#include <QtCore/qpointer.h>
10#include "qwindowscursor.h"
11
12#include <qpa/qplatformwindow.h>
13#include <qpa/qplatformwindow_p.h>
14
15#if QT_CONFIG(vulkan)
16#include "qwindowsvulkaninstance.h"
17#endif
18
19#include <optional>
20
21QT_BEGIN_NAMESPACE
22
23class QWindowsOleDropTarget;
24class QWindowsMenuBar;
25class QDebug;
26
28{
29 static QMargins frameOnPrimaryScreen(const QWindow *w, DWORD style, DWORD exStyle);
30 static QMargins frameOnPrimaryScreen(const QWindow *w, HWND hwnd);
31 static QMargins frame(const QWindow *w, DWORD style, DWORD exStyle, qreal dpi);
32 static QMargins frame(const QWindow *w, HWND hwnd, DWORD style, DWORD exStyle);
33 static QMargins frame(const QWindow *w, HWND hwnd);
34 static QMargins frame(const QWindow *w, const QRect &geometry,
35 DWORD style, DWORD exStyle);
36 static bool handleCalculateSize(const QWindow *window, const QMargins &customMargins, const MSG &msg, LRESULT *result);
37 static void applyToMinMaxInfo(const QWindow *w, const QScreen *screen,
38 const QMargins &margins, MINMAXINFO *mmi);
39 static void applyToMinMaxInfo(const QWindow *w, const QMargins &margins,
40 MINMAXINFO *mmi);
41 static void frameSizeConstraints(const QWindow *w, const QScreen *screen,
42 const QMargins &margins,
43 QSize *minimumSize, QSize *maximumSize);
44 static inline QPoint mapToGlobal(HWND hwnd, const QPoint &);
45 static inline QPoint mapToGlobal(const QWindow *w, const QPoint &);
46 static inline QPoint mapFromGlobal(const HWND hwnd, const QPoint &);
47 static inline QPoint mapFromGlobal(const QWindow *w, const QPoint &);
48
49 static bool positionIncludesFrame(const QWindow *w);
50};
51
53{
54 explicit QWindowCreationContext(const QWindow *w, const QScreen *s,
55 const QRect &geometryIn, const QRect &geometry,
56 const QMargins &customMargins,
57 DWORD style, DWORD exStyle);
58 void applyToMinMaxInfo(MINMAXINFO *mmi) const;
59
61 // The screen to use to scale size constraints, etc. Might differ from the
62 // screen of the window after QPlatformWindow::initialGeometry() (QTBUG-77307).
64 QRect requestedGeometryIn; // QWindow scaled
65 QRect requestedGeometry; // after QPlatformWindow::initialGeometry()
69 QMargins customMargins; // User-defined, additional frame for WM_NCCALCSIZE
70 int frameX = CW_USEDEFAULT; // Passed on to CreateWindowEx(), including frame.
74 int menuHeight = 0;
75};
76
78{
82 QMargins fullFrameMargins; // Do not use directly for windows, see FrameDirty.
83 QMargins customMargins; // User-defined, additional frame for NCCALCSIZE
84 HWND hwnd = nullptr;
85 HWND hwndTitlebar = nullptr;
86 bool embedded = false;
87 bool hasFrame = false;
88
89 static QWindowsWindowData create(const QWindow *w,
90 const QWindowsWindowData &parameters,
91 const QString &title);
92};
93
96{
98public:
101
102 explicit QWindowsBaseWindow(QWindow *window) : QPlatformWindow(window) {}
103
104 WId winId() const override { return WId(handle()); }
105 QRect geometry() const override { return geometry_sys(); }
106 QMargins frameMargins() const override { return fullFrameMargins(); }
107 QPoint mapToGlobal(const QPoint &pos) const override;
108 QPoint mapFromGlobal(const QPoint &pos) const override;
109 virtual QMargins fullFrameMargins() const { return frameMargins_sys(); }
110
111 void setHasBorderInFullScreen(bool border) override;
112 bool hasBorderInFullScreen() const override;
113
114 QMargins customMargins() const override;
115 void setCustomMargins(const QMargins &margins) override;
116
118
119 virtual HWND handle() const = 0;
120 virtual bool isTopLevel() const { return isTopLevel_sys(); }
121
122 unsigned style() const { return GetWindowLongPtr(handle(), GWL_STYLE); }
123 unsigned exStyle() const { return GetWindowLongPtr(handle(), GWL_EXSTYLE); }
124 static bool isRtlLayout(HWND hwnd);
125
126 static QWindowsBaseWindow *baseWindowOf(const QWindow *w);
127 static HWND handleOf(const QWindow *w);
128
129 bool windowEvent(QEvent *event) override;
130
131protected:
132 HWND parentHwnd() const { return GetAncestor(handle(), GA_PARENT); }
133 bool isTopLevel_sys() const;
134 inline bool hasMaximumHeight() const;
135 inline bool hasMaximumWidth() const;
136 inline bool hasMaximumSize() const;
137 QRect frameGeometry_sys() const;
138 QRect geometry_sys() const;
139 void setGeometry_sys(const QRect &rect) const;
142 void hide_sys();
143 void raise_sys();
144 void lower_sys();
145 void setWindowTitle_sys(const QString &title);
146};
147
149{
150public:
151 explicit QWindowsDesktopWindow(QWindow *window)
153
154 QMargins frameMargins() const override { return QMargins(); }
155 bool isTopLevel() const override { return true; }
156
157protected:
158 HWND handle() const override { return m_hwnd; }
159
160private:
161 const HWND m_hwnd;
162};
163
165{
166public:
167 explicit QWindowsForeignWindow(QWindow *window, HWND hwnd);
169
170 void setParent(const QPlatformWindow *window) override;
171 void setGeometry(const QRect &rect) override { setGeometry_sys(rect); }
172 void setVisible(bool visible) override;
175 void setWindowTitle(const QString &title) override { setWindowTitle_sys(title); }
176 bool isForeignWindow() const override { return true; }
177
178protected:
179 HWND handle() const override { return m_hwnd; }
180
181private:
182 const HWND m_hwnd;
183 DWORD m_topLevelStyle;
184};
185
187{
188public:
217
218 QWindowsWindow(QWindow *window, const QWindowsWindowData &data);
220
221 void initialize() override;
222
224
225 QSurfaceFormat format() const override;
226 void setGeometry(const QRect &rect) override;
227 QRect geometry() const override { return m_data.geometry; }
228 QRect normalGeometry() const override;
229 QMargins safeAreaMargins() const override;
230 QRect restoreGeometry() const { return m_data.restoreGeometry; }
232
233 void setVisible(bool visible) override;
234 bool isVisible() const;
235 bool isExposed() const override { return testFlag(Exposed); }
236 bool isActive() const override;
237 bool isAncestorOf(const QPlatformWindow *child) const override;
238 bool isEmbedded() const override;
239 QPoint mapToGlobal(const QPoint &pos) const override;
240 QPoint mapFromGlobal(const QPoint &pos) const override;
241
242 void setWindowFlags(Qt::WindowFlags flags) override;
243 void setWindowState(Qt::WindowStates state) override;
244
245 void setParent(const QPlatformWindow *window) override;
246
247 void setWindowTitle(const QString &title) override;
248 QString windowTitle() const override;
251
252 bool windowEvent(QEvent *event) override;
253
255 static bool handleGeometryChangingMessage(MSG *message, const QWindow *qWindow, const QMargins &marginsDp);
256 bool handleGeometryChanging(MSG *message) const;
257 QMargins frameMargins() const override;
258 QMargins fullFrameMargins() const override;
259 void setFullFrameMargins(const QMargins &newMargins);
261
262 void setOpacity(qreal level) override;
263 void setMask(const QRegion &region) override;
264 qreal opacity() const { return m_opacity; }
266
267 bool setKeyboardGrabEnabled(bool grab) override;
268 bool setMouseGrabEnabled(bool grab) override;
269 inline bool hasMouseCapture() const { return GetCapture() == m_data.hwnd; }
270
271 bool startSystemResize(Qt::Edges edges) override;
273
274 void setFrameStrutEventsEnabled(bool enabled) override;
276
277 // QWindowsBaseWindow overrides
278 HWND handle() const override { return m_data.hwnd; }
279 bool isTopLevel() const override;
280
281 static bool setDarkBorderToWindow(HWND hwnd, bool d);
282 void setDarkBorder(bool d);
283
284 QWindowsMenuBar *menuBar() const;
285 void setMenuBar(QWindowsMenuBar *mb);
286
287 QMargins customMargins() const override;
288 void setCustomMargins(const QMargins &m) override;
289
290 void setStyle(unsigned s) const;
291 void setExStyle(unsigned s) const;
292
293 bool handleWmPaint(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result);
294
295 void handleMoved();
296 void handleResized(int wParam, LPARAM lParam);
297 void handleHidden();
299 void handleDpiScaledSize(WPARAM wParam, LPARAM lParam, LRESULT *result);
300 void handleDpiChanged(HWND hwnd, WPARAM wParam, LPARAM lParam);
301 void handleDpiChangedAfterParent(HWND hwnd);
302
303 static void displayChanged();
304 static void settingsChanged();
305 static QScreen *forcedScreenForGLWindow(const QWindow *w);
306 static QWindowsWindow *windowsWindowOf(const QWindow *w);
307 static QWindow *topLevelOf(QWindow *w);
308 static inline void *userDataOf(HWND hwnd);
309 static inline void setUserDataOf(HWND hwnd, void *ud);
310
311 static bool hasNoNativeFrame(HWND hwnd, Qt::WindowFlags flags);
312 static bool setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal opacity);
313 bool isLayered() const;
314
315 HDC getDC();
316 void releaseDC();
317 void getSizeHints(MINMAXINFO *mmi) const;
318 bool handleNonClientHitTest(const QPoint &globalPos, LRESULT *result) const;
319 bool handleNonClientActivate(LRESULT *result) const;
321
322#ifndef QT_NO_CURSOR
323 CursorHandlePtr cursor() const { return m_cursor; }
324#endif
325 void setCursor(const CursorHandlePtr &c);
326 void applyCursor();
327
328 inline bool testFlag(unsigned f) const { return (m_flags & f) != 0; }
329 inline void setFlag(unsigned f) const { m_flags |= f; }
330 inline void clearFlag(unsigned f) const { m_flags &= ~f; }
331
332 void setEnabled(bool enabled);
333 bool isEnabled() const;
334 void setWindowIcon(const QIcon &icon) override;
335
336 void *surface(void *nativeConfig, int *err);
338
339 void setAlertState(bool enabled) override;
341 void alertWindow(int durationMs = 0);
342 void stopAlertWindow();
343
346
347 void registerTouchWindow();
348 static void setHasBorderInFullScreenStatic(QWindow *window, bool border);
349 static void setHasBorderInFullScreenDefault(bool border);
350 void setHasBorderInFullScreen(bool border) override;
351 bool hasBorderInFullScreen() const override;
352 static QString formatWindowTitle(const QString &title);
353
356
357 void setSavedDpi(int dpi) { m_savedDpi = dpi; }
358 int savedDpi() const { return m_savedDpi; }
359 qreal dpiRelativeScale(const UINT dpi) const;
360
361 bool isClientAreaExpanded() const { return m_data.flags.testFlag(Qt::ExpandedClientAreaHint); }
362
363 void requestUpdate() override;
364
365private:
366 inline void show_sys() const;
367 inline QWindowsWindowData setWindowFlags_sys(Qt::WindowFlags wt, unsigned flags = 0) const;
368 inline bool isFullScreen_sys() const;
369 inline void setWindowState_sys(Qt::WindowStates newState);
370 inline void setParent_sys(const QPlatformWindow *parent);
371 inline void updateTransientParent() const;
372 void destroyWindow();
373 inline bool isDropSiteEnabled() const { return m_dropTarget != nullptr; }
374 void setDropSiteEnabled(bool enabled);
375 void updateDropSite(bool topLevel);
376 void handleGeometryChange();
377 void handleWindowStateChange(Qt::WindowStates state);
378 inline void destroyIcon();
379 void fireExpose(const QRegion &region, bool force=false);
380 void fireFullExpose(bool force=false);
381 void calculateFullFrameMargins();
382 void correctWindowPlacement(WINDOWPLACEMENT &windowPlacement);
383
384 mutable QWindowsWindowData m_data;
385 QPointer<QWindowsMenuBar> m_menuBar;
386 mutable unsigned m_flags = WithinCreate;
387 HDC m_hdc = nullptr;
388 Qt::WindowStates m_windowState = Qt::WindowNoState;
389 QString m_windowTitle;
390 qreal m_opacity = 1;
391#ifndef QT_NO_CURSOR
392 CursorHandlePtr m_cursor;
393#endif
394 QWindowsOleDropTarget *m_dropTarget = nullptr;
395 unsigned m_savedStyle = 0;
396 QRect m_savedFrameGeometry;
397 HICON m_iconSmall = nullptr;
398 HICON m_iconBig = nullptr;
399 void *m_surface = nullptr;
400 int m_savedDpi = 96;
401
402 static bool m_screenForGLInitialized;
403
404#if QT_CONFIG(vulkan)
405 // note: intentionally not using void * in order to avoid breaking x86
407#endif
408 static bool m_borderInFullScreenDefault;
409 static bool m_inSetgeometry;
410
411 qsizetype m_vsyncServiceCallbackId = 0;
412 QAtomicInt m_vsyncUpdatePending;
413};
414
415#ifndef QT_NO_DEBUG_STREAM
416QDebug operator<<(QDebug d, const RECT &r);
417QDebug operator<<(QDebug d, const POINT &);
418QDebug operator<<(QDebug d, const MINMAXINFO &i);
419QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p);
420QDebug operator<<(QDebug d, const WINDOWPLACEMENT &);
421QDebug operator<<(QDebug d, const WINDOWPOS &);
422QDebug operator<<(QDebug d, const GUID &guid);
423#endif // !QT_NO_DEBUG_STREAM
424
425static inline void clientToScreen(HWND hwnd, POINT *wP)
426{
427 if (QWindowsBaseWindow::isRtlLayout(hwnd)) {
428 RECT clientArea;
429 GetClientRect(hwnd, &clientArea);
430 wP->x = clientArea.right - wP->x;
431 }
432 ClientToScreen(hwnd, wP);
433}
434
435static inline void screenToClient(HWND hwnd, POINT *wP)
436{
437 ScreenToClient(hwnd, wP);
438 if (QWindowsBaseWindow::isRtlLayout(hwnd)) {
439 RECT clientArea;
440 GetClientRect(hwnd, &clientArea);
441 wP->x = clientArea.right - wP->x;
442 }
443}
444
445// ---------- QWindowsGeometryHint inline functions.
446QPoint QWindowsGeometryHint::mapToGlobal(HWND hwnd, const QPoint &qp)
447{
448 POINT p = { qp.x(), qp.y() };
449 clientToScreen(hwnd, &p);
450 return QPoint(p.x, p.y);
451}
452
453QPoint QWindowsGeometryHint::mapFromGlobal(const HWND hwnd, const QPoint &qp)
454{
455 POINT p = { qp.x(), qp.y() };
456 screenToClient(hwnd, &p);
457 return QPoint(p.x, p.y);
458}
459
460QPoint QWindowsGeometryHint::mapToGlobal(const QWindow *w, const QPoint &p)
461 { return QWindowsGeometryHint::mapToGlobal(QWindowsWindow::handleOf(w), p); }
462
463QPoint QWindowsGeometryHint::mapFromGlobal(const QWindow *w, const QPoint &p)
464 { return QWindowsGeometryHint::mapFromGlobal(QWindowsWindow::handleOf(w), p); }
465
466
467// ---------- QWindowsBaseWindow inline functions.
468
469inline QWindowsWindow *QWindowsWindow::windowsWindowOf(const QWindow *w)
470{
471 if (!w || !w->handle() || w->handle()->isForeignWindow())
472 return nullptr;
473
474 return static_cast<QWindowsWindow *>(w->handle());
475}
476
477void *QWindowsWindow::userDataOf(HWND hwnd)
478{
479 return reinterpret_cast<void *>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
480}
481
482void QWindowsWindow::setUserDataOf(HWND hwnd, void *ud)
483{
484 SetWindowLongPtr(hwnd, GWLP_USERDATA, LONG_PTR(ud));
485}
486
487inline void QWindowsWindow::destroyIcon()
488{
489 if (m_iconBig) {
490 DestroyIcon(m_iconBig);
491 m_iconBig = nullptr;
492 }
493 if (m_iconSmall) {
494 DestroyIcon(m_iconSmall);
495 m_iconSmall = nullptr;
496 }
497}
498
499inline bool QWindowsWindow::isLayered() const
500{
501 return GetWindowLongPtr(m_data.hwnd, GWL_EXSTYLE) & WS_EX_LAYERED;
502}
503
504QT_END_NAMESPACE
505
506Q_DECLARE_METATYPE(QMargins)
507
508#endif // QWINDOWSWINDOW_H
Base class for QWindowsForeignWindow, QWindowsWindow.
virtual bool isTopLevel() const
QMargins frameMargins_sys() const
bool isTopLevel_sys() const
unsigned exStyle() 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
HWND parentHwnd() const
virtual QMargins fullFrameMargins() const
unsigned style() 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)
Platform cursor implementation.
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()
Windows native menu bar.
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.
Windows screen.
virtual void * moduleHandle() const =0
Raster or OpenGL Window.
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)
int savedDpi() const
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)
qreal opacity() const
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
bool isLayered() const
void handleDpiChanged(HWND hwnd, WPARAM wParam, LPARAM lParam)
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 isEnabled() 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)
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.
@ WithinSetParent
Automatic mouse capture on button press.
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 setWindowState(Qt::WindowStates state) override
Requests setting the window state of this surface to type.
void setCursor(const CursorHandlePtr &c)
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
bool isVisible() 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 &region) 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.
static int resourceType(const QByteArray &key)
static void clientToScreen(HWND hwnd, POINT *wP)
static void screenToClient(HWND hwnd, POINT *wP)
Active Context for creating windows.
const QScreen * screen
const QWindow * window
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
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)
Qt::WindowFlags flags
static QWindowsWindowData create(const QWindow *w, const QWindowsWindowData &parameters, const QString &title)