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.cpp
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#include <qohosfloatingwindow.h>
5
6#include <QtCore/private/qohoslogger_p.h>
7#include "QtGui/private/qguiapplication_p.h"
8#include <QtGui/private/qwindow_p.h>
9#include <qohosdeviceinfo_p.h>
10#include <qohosinputcontext.h>
11#include <qohosinputmethodeventhandler.h>
12#include <qohosjsmain.h>
13#include <qohosplatformbackingstore.h>
14#include <qohosplatformwindow.h>
15#include <qohosruntimedevicetypeandmode.h>
16#include <qohossettings.h>
17#include <render/qohossurface.h>
18#include <render/qohoswindowproxy.h>
19#include <render/qwindowproxyregistry.h>
20
22
23namespace {
24
26 QWindow *window, QOhosWindowProxy::RectChangeOptions rectChangeOptions)
27{
28 return !QOhosSettings::instance().isWindowPcModeEnabled()
29 && rectChangeOptions.rect.isValid()
30 && window->geometry() != rectChangeOptions.rect
31 && rectChangeOptions.reason == QOhosWindowProxy::RectChangeReason::UNDEFINED;
32}
33
34bool shouldClearQtFocusOnSystemFocusLoss(QWindow *windowLosingSystemFocus)
35{
36 return QGuiApplicationPrivate::focus_window == windowLosingSystemFocus
37 || (QGuiApplicationPrivate::focus_window != nullptr
38 && QOhosPlatformWindow::platformWindowFlagsForQWindow(
39 QGuiApplicationPrivate::focus_window).testFlag(Qt::WindowDoesNotAcceptFocus));
40}
41
43{
44 return !QWindowProxyRegistry::instance().queryWindowsWithSystemWindowAndFocus().empty();
45}
46
47}
48
50: QOhosPlatformWindow(window)
51{
52}
53
55
56void QOhosFloatingWindow::setGeometry(const QRect &rect)
57{
58 auto *view = ownedViewOrNull();
59 bool geometryControlledBySystem =
60 !QOhosSettings::instance().isWindowPcModeEnabled()
61 && view != nullptr
62 && view->viewType() == QOhosView::ViewType::MainWindow;
63
64 if (geometryControlledBySystem) {
65 setWindowGeometryFromOhos(windowGeometry());
66 return;
67 }
68
69 auto *currentScreen = QOhosPlatformWindow::screen();
70 QOhosPlatformWindow::setGeometry(rect);
71
72 auto *targetScreen = QOhosPlatformWindow::screenForGeometry(rect.marginsAdded(frameMargins()));
73 if (targetScreen != nullptr && targetScreen != currentScreen)
74 QWindowSystemInterface::handleWindowScreenChanged(window(), targetScreen->screen());
75
76 if (view != nullptr) {
77 auto frameGeometry = rect.marginsAdded(frameMargins());
78 if (!qt_window_private(window())->positionAutomatic)
79 view->setPosition(frameGeometry.topLeft());
80 view->setSize(frameGeometry.size());
81
82 if (view->viewType() == QOhosView::ViewType::EmbeddedWindow)
83 setWindowGeometryFromOhos(rect);
84 }
85}
86
88{
89 if (!visible)
90 m_view->hide();
91 else
92 m_view->showImmediate();
93 startAsyncWaitForNodeResizeIfNeeded();
94}
95
97{
98 auto windowObjectName = window()->objectName();
99
100 qOhosPrintfDebug(
101 "%s: winId called for window named: \"%s\"",
102 Q_FUNC_INFO,
103 windowObjectName.toStdString().c_str());
104
105 return reinterpret_cast<WId>(m_view->viewWindowId());
106}
107
109{
110 auto *view = ownedViewOrNull();
111 if (view != nullptr) {
112 view->raise();
113 window()->requestUpdate();
114 }
115}
116
118{
119 auto *view = ownedViewOrNull();
120 if (view != nullptr) {
121 view->lower();
122 window()->requestUpdate();
123 }
124}
125
127{
128 auto *view = ownedViewOrNull();
129 return view != nullptr ? view->surfaceOrNull() : nullptr;
130}
131
133{
134 return m_view.get();
135}
136
138{
140 m_view = QOhosView::createForWindow(this, propertiesProvider());
141
142 auto *qWindow = window();
143
144 // HACK
145 // There is no functionality to fetch the initial window status from ohos
146 // We can only listen for the changes - we need to assume sane default for tablets
147 // so assign the default most-likely status of the tablet here.
148 if (m_view->viewType() == QOhosView::ViewType::MainWindow
149 && !QOhosSettings::instance().isWindowPcModeEnabled()
150 && !m_lastWindowStatusType.has_value()) {
151 m_lastWindowStatusType = QOhosWindowProxy::WindowStatusType::FULL_SCREEN;
152 }
153
154 QObject::connect(
155 m_view.get(), &QOhosView::externalContentInteractionDetected,
156 qWindow, &QOhosPlatformWindow::closeAllActivePopups);
157
158 QObject::connect(
159 m_view.get(), &QOhosView::nodeAreaChanged, m_view.get(),
160 [this](QArkUi::QQtEmbeddedWindowNode::NodeAreaInfo event) {
161 handleNodeResizeEvent(event);
162 });
163
164 QObject::connect(
165 m_view.get(), &QOhosView::windowEvent,
166 qWindow,
167 [this](QOhosWindowProxy::WindowEvent evt) { handleWindowEvent(evt); });
168
169 QObject::connect(
170 m_view.get(), &QOhosView::windowStatusChange,
171 qWindow,
172 [this](QOhosWindowProxy::WindowStatus evt) { handleWindowStatusChange(evt); });
173
174 QObject::connect(
175 m_view.get(), &QOhosView::windowVisibilityChange,
176 qWindow,
177 [this](bool visible) { handleWindowVisibilityChange(visible); });
178
179 bool monitorAvoidAreaChange =
180 !(isHandheldDeviceType() && m_view->viewType() == QOhosView::ViewType::SubWindow);
181
182 if (monitorAvoidAreaChange) {
183 QObject::connect(
184 m_view.get(), &QOhosView::avoidAreaChanged,
185 qWindow,
186 [this](QOhosWindowProxy::AvoidAreaType avoidAreaType,
187 const QOhosWindowProxy::AvoidArea &systemAvoidArea) {
188 handleAvoidAreaChanged(avoidAreaType, systemAvoidArea);
189 });
190 }
191
192 QObject::connect(
193 m_view.get(), &QOhosView::windowRectChangedInGlobalDisplay,
194 qWindow,
195 [this](const QOhosWindowProxy::RectChangeOptions &rectChangeOptions) {
196 handleWindowRectChanged(rectChangeOptions);
197 });
198
199 QObject::connect(qWindow, &QWindow::modalityChanged, m_view.get(), &QOhosView::setModality);
200
201 QObject::connect(
202 m_view.get(), &QOhosView::surfaceStatusChanged,
203 qWindow,
204 [this](const std::optional<QSize> &optSurfaceSize) { handleSurfaceStatusChanged(optSurfaceSize); });
205
206 QObject::connect(qWindow, &QWindow::windowTitleChanged, m_view.get(), &QOhosView::setTitle);
207
208 QObject::connect(
209 m_view.get(), &QOhosView::windowDisplayIdChanged,
210 qWindow,
211 [this](QOhosDisplayInfo::JsDisplayId displayId) { handleWindowDisplayIdChanged(displayId); });
212}
213
214void QOhosFloatingWindow::restoreWindowCurrentCursorIfNeeded()
215{
216 auto *view = ownedViewOrNull();
217 if (view != nullptr && m_cursor.has_value())
218 view->setCursor(m_cursor.value());
219}
220
222 Qt::WindowFlags previousWindowFlags, Qt::WindowFlags currentWindowFlags)
223{
224 auto *view = ownedViewOrNull();
225 if (view == nullptr)
226 return;
227
228 view->handleWindowFlagsChange(previousWindowFlags, currentWindowFlags);
229}
230
232 Qt::WindowStates oldWindowState, Qt::WindowStates currentWindowState)
233{
234 auto *view = ownedViewOrNull();
235 if (view == nullptr)
236 return;
237
238 view->handleWindowStateChange(oldWindowState, currentWindowState);
239}
240
241void QOhosFloatingWindow::internalHijackSystemFocusAsPopup()
242{
243 QWindowSystemInterface::handleFocusWindowChanged(window(), Qt::PopupFocusReason);
244}
245
246void QOhosFloatingWindow::focusHijackingPopupHidden()
247{
248 auto systemFocusedWindows = QWindowProxyRegistry::instance().queryWindowsWithSystemWindowAndFocus();
249 QWindowSystemInterface::handleFocusWindowChanged(
250 !systemFocusedWindows.empty() ? systemFocusedWindows.front() : nullptr,
251 Qt::ActiveWindowFocusReason);
252}
253
254void QOhosFloatingWindow::setMask(const QRegion &region)
255{
256 m_windowMask = region;
257
258 auto *view = ownedViewOrNull();
259 if (view == nullptr)
260 return;
261
263}
264
266{
267 auto *view = ownedViewOrNull();
268 if (view != nullptr)
269 return view->startMoving();
270 return false;
271}
272
274{
275 if (windowFlags().testFlag(Qt::WindowDoesNotAcceptFocus) && window()->type() == Qt::Popup) {
276 internalHijackSystemFocusAsPopup();
277 return;
278 }
279
281}
282
283void QOhosFloatingWindow::handleWindowEvent(QOhosWindowProxy::WindowEvent evt)
284{
285 auto *qWindow = window();
286 bool windowAcceptsFocusAndInput = checkWindowAcceptsFocus() && checkWindowAcceptsInput();
287 auto previousWindowEventType = std::exchange(m_lastWindowEventType, evt.type);
288
289 if (evt.type != QOhosWindowProxy::WindowEventType::WINDOW_SHOWN)
290 m_activationEventDeferredUntilWindowUnblocked.reset();
291
292 switch (evt.type) {
293 case QOhosWindowProxy::WindowEventType::WINDOW_ACTIVE:
294 {
295 QWindow *modalWindow = nullptr;
296 if (QGuiApplicationPrivate::instance()->isWindowBlocked(qWindow, &modalWindow)
297 && qWindow != modalWindow) {
298 if (qWindow->isTopLevel())
299 m_activationEventDeferredUntilWindowUnblocked = evt;
300 modalWindow->requestActivate();
301 return;
302 }
303
304 // FIXME - restore cursor set by the User every time window is activated.
305 // Perform it because Ohos overrides it with default "standard arrow" cursor (when
306 // window is deactivated) and does not bring selected cursor back (when window is
307 // activated again). This bahaviour is Ohos platform issue.
308 restoreWindowCurrentCursorIfNeeded();
309 if (windowAcceptsFocusAndInput) {
310 QWindowSystemInterface::handleFocusWindowChanged(qWindow, Qt::ActiveWindowFocusReason);
312 }
313 break;
314 }
315 case QOhosWindowProxy::WindowEventType::WINDOW_INACTIVE:
316 if (!windowAcceptsFocusAndInput)
317 break;
318 if (shouldClearQtFocusOnSystemFocusLoss(qWindow) && !anyQtWindowHoldsSystemFocus())
319 QWindowSystemInterface::handleFocusWindowChanged(nullptr, Qt::ActiveWindowFocusReason);
321 break;
322 case QOhosWindowProxy::WindowEventType::WINDOW_HIDDEN:
323 if (!checkWindowAcceptsFocus() && QGuiApplicationPrivate::focus_window == qWindow)
324 focusHijackingPopupHidden();
325 setExposedFromOhos(false);
326 break;
327 case QOhosWindowProxy::WindowEventType::WINDOW_SHOWN:
328 // HACK
329 // This is a fix for the windows hidden using `QWidget::hide()`.
330 // When a window is hidden and then bring back from the system Dock
331 // Qt side keeps wrong (hidden) state. This causes different issues due to
332 // improper state. To fix it - change visibility state based on the system
333 // window state.
334 if (previousWindowEventType == QOhosWindowProxy::WindowEventType::WINDOW_HIDDEN && !qWindow->isVisible())
335 qWindow->setVisible(true);
336 setExposedFromOhos(true);
337 startAsyncWaitForNodeResizeIfNeeded();
338 break;
339 case QOhosWindowProxy::WindowEventType::WINDOW_DESTROYED:
341 return;
342 }
343}
344
345void QOhosFloatingWindow::handleWindowStatusChange(QOhosWindowProxy::WindowStatus evt)
346{
347 auto *qWindow = window();
348 qCDebug(
349 QtForOhos,
350 "Window status changed, window: %p(%s) status: %d",
351 qWindow,
352 qPrintable(qWindow->objectName()),
353 evt.type);
354
355 // Drop duplicate FULL_SCREEN notifications; MainWindow views in non-PC mode
356 // are exempt because initialize() pre-seeds their status to FULL_SCREEN.
357 if (m_lastWindowStatusType == evt.type
358 && m_lastWindowStatusType == QOhosWindowProxy::WindowStatusType::FULL_SCREEN
359 && !(m_view->viewType() == QOhosView::ViewType::MainWindow
360 && !QOhosSettings::instance().isWindowPcModeEnabled())) {
361 qCDebug(QtForOhos, "Window status is the same as the previous one");
362 return;
363 }
364
365 Qt::WindowStates windowStatesToSet = windowStates();
366 m_lastWindowStatusType = evt.type;
367
368 switch (evt.type) {
369 // NOTE - Qt::WindowFullScreen and Qt::WindowMaximized represent the exact same
370 // OHOS Window state.
371 case QOhosWindowProxy::WindowStatusType::FULL_SCREEN:
372 case QOhosWindowProxy::WindowStatusType::MAXIMIZE:
373 windowStatesToSet = m_view->isFullscreenImmersiveModeEnabled()
374 ? Qt::WindowState::WindowFullScreen
375 : Qt::WindowState::WindowMaximized;
376 break;
377 case QOhosWindowProxy::WindowStatusType::MINIMIZE:
378 if (m_view->consumePendingSelfMinimizeEcho()) {
379 // The window is hidden in Qt's view, so ignore this echo entirely.
380 // Deliberately skip setWindowStateFromOhos() and the node-resize
381 // reconciliation below: reporting WindowMinimized would cause a
382 // spurious restore -> QShowEvent, and the reconciliation would apply
383 // the minimized node's geometry to a window Qt still considers to be
384 // at its normal (pre-hide) geometry. showImmediate() reconciles it
385 // when the window is shown again.
386 return;
387 }
388 windowStatesToSet.setFlag(Qt::WindowState::WindowMinimized);
389 break;
390 case QOhosWindowProxy::WindowStatusType::UNDEFINED:
391 case QOhosWindowProxy::WindowStatusType::FLOATING:
392 case QOhosWindowProxy::WindowStatusType::SPLIT_SCREEN:
393 windowStatesToSet = Qt::WindowState::WindowNoState;
394 break;
395 }
396
397 setWindowStateFromOhos(windowStatesToSet);
398
399 // HACK
400 // There is no functionality in OHOS to fetch the window status that would allow checking
401 // the value while processing the WINDOW_SHOWN window event type. Therefore, the window
402 // geometry view needs to be recalculated with any change.
403 startAsyncWaitForNodeResizeIfNeeded();
404}
405
406void QOhosFloatingWindow::handleWindowVisibilityChange(bool visible)
407{
408 auto *qWindow = window();
409 qCDebug(
410 QtForOhos,
411 "Window %p(%s) visibility changed: %s",
412 qWindow,
413 qPrintable(qWindow->objectName()),
414 visible ? "true" : "false");
415 if (visible && m_windowMask.has_value())
416 m_view->setWindowMask(QOhosWindowProxy::WindowMask{m_windowMask.value()});
417
418 setExposedFromOhos(visible);
419}
420
421void QOhosFloatingWindow::handleAvoidAreaChanged(
422 QOhosWindowProxy::AvoidAreaType avoidAreaType,
423 const QOhosWindowProxy::AvoidArea &systemAvoidArea)
424{
425 const auto &cached = m_avoidAreaCache[avoidAreaType];
426
427 bool actuallyChanged =
428 cached.visible != systemAvoidArea.visible
429 || cached.leftRect != systemAvoidArea.leftRect
430 || cached.rightRect != systemAvoidArea.rightRect
431 || cached.bottomRect != systemAvoidArea.bottomRect
432 || cached.topRect != systemAvoidArea.topRect;
433
434 if (actuallyChanged) {
435 m_avoidAreaCache[avoidAreaType] = systemAvoidArea;
436 qCDebug(QtForOhos) << "Avoid area changed:"
437 << static_cast<int>(avoidAreaType)
438 << "visible:" << systemAvoidArea.visible
439 << "top:" << systemAvoidArea.topRect
440 << "left:" << systemAvoidArea.leftRect
441 << "right:" << systemAvoidArea.rightRect
442 << "bottom:" << systemAvoidArea.bottomRect;
443 startAsyncWaitForNodeResizeIfNeeded();
444 }
445}
446
447void QOhosFloatingWindow::handleSurfaceStatusChanged(const std::optional<QSize> &optSurfaceSize)
448{
449 m_optLastSurfaceSize = optSurfaceSize;
450 bool hasSurface = m_view->surfaceOrNull() != nullptr;
451 if (m_view->viewType() == QOhosView::ViewType::EmbeddedWindow) {
452 setExposedFromOhos(hasSurface);
453 }
454
455 if (hasSurface)
456 startAsyncWaitForNodeResizeIfNeeded();
457}
458
459void QOhosFloatingWindow::handleWindowDisplayIdChanged(QOhosDisplayInfo::JsDisplayId displayId)
460{
461 setDisplayIdFromOhos(displayId);
462 startAsyncWaitForNodeResizeIfNeeded();
463}
464
465void QOhosFloatingWindow::handleWindowRectChanged(
466 const QOhosWindowProxy::RectChangeOptions &rectChangeOptions)
467{
468 bool needsCloseAllActivePopups = rectChangeOptions.reason == QOhosWindowProxy::RectChangeReason::DRAG_START;
469
470 qCDebug(QtForOhos)
471 << "windowRectChanged window:" << window()
472 << "rect:" << rectChangeOptions.rect
473 << "reason:" << static_cast<int>(rectChangeOptions.reason);
474
475 startAsyncWaitForNodeResizeIfNeeded();
476
477 if (isWindowRotatedByTabletScreenRotation(window(), rectChangeOptions))
478 needsCloseAllActivePopups = true;
479
480 if (needsCloseAllActivePopups)
482}
483
485{
486 if (event->type() == QEvent::WindowUnblocked) {
487 auto deferredActivationEvent =
488 std::exchange(m_activationEventDeferredUntilWindowUnblocked, std::nullopt);
489 const QWindow *windowHoldingFocus = QGuiApplicationPrivate::focus_window;
490 bool noVisibleWindowHoldsFocus =
491 windowHoldingFocus == nullptr || !windowHoldingFocus->isVisible();
492 if (deferredActivationEvent && noVisibleWindowHoldsFocus)
493 handleWindowEvent(*deferredActivationEvent);
494 }
495
496 if (event->type() == QEvent::Timer) {
497 auto *timerEvent = static_cast<QTimerEvent *>(event);
498 if (m_view && timerEvent->timerId() == m_geometryChangeTimer.timerId()) {
499 auto syntheticEvent = m_view->nodeAreaInfo();
500 handleNodeResizeEvent(syntheticEvent);
501 }
502 }
503
504 return QOhosPlatformWindow::windowEvent(event);
505}
506
507void QOhosFloatingWindow::startAsyncWaitForNodeResizeIfNeeded()
508{
509 constexpr auto geometryChangeEventTimeoutMs = std::chrono::milliseconds(16);
510
511 if (!m_geometryChangeTimer.isActive()) {
512 m_geometryChangeTimer.start(
513 geometryChangeEventTimeoutMs.count(),
514 Qt::PreciseTimer,
515 window());
516 }
517}
518
519void QOhosFloatingWindow::handleNodeResizeEvent(const QArkUi::QQtEmbeddedWindowNode::NodeAreaInfo &areaChangeEvent)
520{
521 m_geometryChangeTimer.stop();
522
523 if (Q_UNLIKELY(!m_view))
524 return;
525
526 if (m_view->viewType() != QOhosView::ViewType::EmbeddedWindow)
527 setWindowGeometryFromOhos(
528 QRect(areaChangeEvent.globalRelativeOffsetPixels, areaChangeEvent.screenGeometryPixels.size()));
529
530 updateSafeAreaMargins();
531}
532
533// Map display-space cutout rects to window-relative margins, each attributed to
534// the nearest window edge.
535static QMargins cutoutMarginsForWindow(const QList<QRect> &cutoutRects, const QRect &windowRect)
536{
537 QMargins margins;
538 for (const QRect &cutout : cutoutRects) {
539 if (cutout.isEmpty() || !cutout.intersects(windowRect))
540 continue;
541 const int distTop = cutout.top() - windowRect.top();
542 const int distBottom = windowRect.bottom() - cutout.bottom();
543 const int distLeft = cutout.left() - windowRect.left();
544 const int distRight = windowRect.right() - cutout.right();
545 int nearest = qMin(qMin(distTop, distBottom), qMin(distLeft, distRight));
546 if (nearest == distTop)
547 margins.setTop(qMax(margins.top(), cutout.bottom() + 1 - windowRect.top()));
548 else if (nearest == distBottom)
549 margins.setBottom(qMax(margins.bottom(), windowRect.bottom() + 1 - cutout.top()));
550 else if (nearest == distLeft)
551 margins.setLeft(qMax(margins.left(), cutout.right() + 1 - windowRect.left()));
552 else
553 margins.setRight(qMax(margins.right(), windowRect.right() + 1 - cutout.left()));
554 }
555 return margins;
556}
557
558void QOhosFloatingWindow::updateSafeAreaMargins()
559{
560 // The system bar and navigation indicator avoid areas are window-relative
561 // and visibility-aware: they report zero when hidden (e.g. in fullscreen).
562 static constexpr QOhosWindowProxy::AvoidAreaType kSafeAreaContributors[] = {
563 QOhosWindowProxy::AvoidAreaType::TYPE_SYSTEM,
564 QOhosWindowProxy::AvoidAreaType::TYPE_NAVIGATION_INDICATOR,
565 };
566
567 // Avoid-area sizes are relative to the full window; subtract the inset the
568 // compositor already applies (frame vs. true on-screen content) so a normal
569 // window reports no safe area, matching Android's max(0, inset - offset).
570 // nodeScreenGeometryPixels() is the real content rect; drawableRect lies.
571 const QRect frame = m_view->viewGeometry().frameGeometry;
572 const QRect content = m_view->nodeScreenGeometryPixels();
573 const int alreadyTop = content.top() - frame.top();
574 const int alreadyLeft = content.left() - frame.left();
575 const int alreadyRight = frame.right() - content.right();
576 const int alreadyBottom = frame.bottom() - content.bottom();
577
578 QMargins combined;
579 for (auto type : kSafeAreaContributors) {
580 const QMargins m = m_view->avoidAreaMargins(type);
581 combined.setTop(qMax(combined.top(), qMax(0, m.top() - alreadyTop)));
582 combined.setLeft(qMax(combined.left(), qMax(0, m.left() - alreadyLeft)));
583 combined.setRight(qMax(combined.right(), qMax(0, m.right() - alreadyRight)));
584 combined.setBottom(qMax(combined.bottom(), qMax(0, m.bottom() - alreadyBottom)));
585 }
586
587 // The display cutout is not in the avoid areas; fold it in from
588 // getCutoutInfo() (fetched fresh as it rotates with the display) and report
589 // it even in fullscreen, mapped against the content area.
590 const QMargins cutout = cutoutMarginsForWindow(m_view->displayCutoutRects(), content);
591 combined.setTop(qMax(combined.top(), cutout.top()));
592 combined.setLeft(qMax(combined.left(), cutout.left()));
593 combined.setRight(qMax(combined.right(), cutout.right()));
594 combined.setBottom(qMax(combined.bottom(), cutout.bottom()));
595
596 setSafeAreaMarginsFromOhos(combined);
597}
598
599QT_END_NAMESPACE
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
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.
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.
void setDisplayIdFromOhos(std::optional< QOhosDisplayInfo::JsDisplayId > displayId)
void setExposedFromOhos(bool exposed)
void initialize() override
Called as part of QWindow::create(), after constructing the window.
void notifyInputSystemsWindowActiveStatusChanged(bool active)
void requestActivateWindow() override
Reimplement to let Qt be able to request activation/focus for a window.
QOhosSurface * surfaceOrNull() const
void setWindowMask(const QOhosWindowProxy::WindowMask &windowMask)
void lower()
bool startMoving()
void raise()
QtOhos::enums::ohos::window::WindowEventType WindowEventType
static QWindowProxyRegistry & instance()
Combined button and popup list for selecting options.
bool shouldClearQtFocusOnSystemFocusLoss(QWindow *windowLosingSystemFocus)
bool isWindowRotatedByTabletScreenRotation(QWindow *window, QOhosWindowProxy::RectChangeOptions rectChangeOptions)
static QMargins cutoutMarginsForWindow(const QList< QRect > &cutoutRects, const QRect &windowRect)