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