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
qohosfloatingwindow.h
Go to the documentation of this file.
1// Copyright (C) 2025 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 QOHOSFLOATINGWINDOW_H
5#define QOHOSFLOATINGWINDOW_H
6
7#include <QtCore/qglobal.h>
8#include <QtCore/qmap.h>
9#include <napi.h>
10#include <qohosplatformscreen.h>
11#include <qohosplatformwindow.h>
12#include <qohosplugincore.h>
13#include <render/qohossurface.h>
14#include <render/qohosview.h>
15
17
19{
20public:
21 explicit QOhosFloatingWindow(QWindow *window);
23
24 void initialize() override;
25 void setGeometry(const QRect &rect) override;
26
27 void setVisible(bool visible) override;
28
29 WId winId() const override;
30
31 void raise() override;
32 void lower() override;
33
34 QOhosSurface *ownedSurfaceOrNull() const override;
35 QOhosView *ownedViewOrNull() const override;
36
37 void setMask(const QRegion &region) override;
39
41
42private:
43 void tryAcquireNativeSurfaceIfNeeded();
44 void updateWindowGeometryFromView(QOhosView &view);
45 void updateWindowGeometryFromSurface();
46 void restoreWindowCurrentCursorIfNeeded();
48 Qt::WindowFlags previousWindowFlags, Qt::WindowFlags currentWindowFlags) override;
50 Qt::WindowStates oldWindowState, Qt::WindowStates currentWindowState) override;
51
52 void internalHijackSystemFocusAsPopup();
53 void focusHijackingPopupHidden();
54
55 void handleWindowEvent(QOhosWindowProxy::WindowEvent evt);
56 void handleWindowStatusChange(QOhosWindowProxy::WindowStatus evt);
57 void handleWindowVisibilityChange(bool visible);
58 void handleAvoidAreaChanged(QOhosWindowProxy::AvoidAreaType avoidAreaType,
59 const QOhosWindowProxy::AvoidArea &systemAvoidArea);
60 void handleWindowRectChanged(const QOhosWindowProxy::RectChangeOptions &rectChangeOptions);
61 void handleSurfaceStatusChanged(const QOhosOptional<QSize> &optSurfaceSize);
62 void handleWindowDisplayIdChanged(QOhosDisplayInfo::JsDisplayId displayId);
63
64 std::unique_ptr<QOhosView> m_view;
65 QOhosOptional<QOhosWindowProxy::WindowEventType> m_lastWindowEventType;
66 QOhosOptional<QOhosWindowProxy::WindowStatusType> m_lastWindowStatusType;
67 QOhosOptional<QRegion> m_windowMask;
68 QOhosOptional<QOhosWindowProxy::RectChangeOptions> m_lastRectChangeOptions;
69 QOhosOptional<QSize> m_optLastSurfaceSize;
70 QMap<QOhosWindowProxy::AvoidAreaType, QOhosWindowProxy::AvoidArea> m_avoidAreaCache;
71};
72
73QT_END_NAMESPACE
74
75#endif // QOHOSFLOATINGWINDOW_H
QOhosFloatingWindow(QWindow *window)
~QOhosFloatingWindow() override
void requestActivateWindow() override
Reimplement to let Qt be able to request activation/focus for a window.
void setVisible(bool visible) override
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false.
bool startSystemMove() override
Reimplement this method to start a system move operation if the system supports it and return true to...
QOhosView * ownedViewOrNull() const override
void onWindowStateChanged(Qt::WindowStates oldWindowState, Qt::WindowStates currentWindowState) override
WId winId() const override
Reimplement in subclasses to return a handle to the native window.
void initialize() override
Called as part of QWindow::create(), after constructing the window.
void onWindowFlagsChanged(Qt::WindowFlags previousWindowFlags, Qt::WindowFlags currentWindowFlags) override
void setGeometry(const QRect &rect) override
This function is called by Qt whenever a window is moved or resized using the QWindow API.
QOhosSurface * ownedSurfaceOrNull() const override
void setMask(const QRegion &region) override
Reimplement to be able to let Qt set the mask of a window.
void lower() override
Reimplement to be able to let Qt lower windows to the bottom of the desktop.
void raise() override
Reimplement to be able to let Qt raise windows to the top of the desktop.
std::enable_if_t< qohosplugincore_h_detail::isQOhosOptional< QOhosInvokeResult< Func, T > >, QOhosInvokeResult< Func, T > > andThen(Func &&func) const
Combined button and popup list for selecting options.