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{
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 const auto frameGeometry = lastRequestedWindowFrameGeometry();
72
73 auto *targetScreen = QOhosPlatformWindow::screenForGeometry(frameGeometry);
74 if (targetScreen != nullptr && targetScreen != currentScreen)
75 QWindowSystemInterface::handleWindowScreenChanged(window(), targetScreen->screen());
76
77 if (view != nullptr) {
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}
94
96{
97 auto windowObjectName = window()->objectName();
98
99 qOhosPrintfDebug(
100 "%s: winId called for window named: \"%s\"",
101 Q_FUNC_INFO,
102 windowObjectName.toStdString().c_str());
103
104 return reinterpret_cast<WId>(m_view->viewWindowId());
105}
106
108{
109 auto *view = ownedViewOrNull();
110 if (view != nullptr) {
111 view->raise();
112 window()->requestUpdate();
113 }
114}
115
117{
118 auto *view = ownedViewOrNull();
119 if (view != nullptr) {
120 view->lower();
121 window()->requestUpdate();
122 }
123}
124
126{
127 auto *view = ownedViewOrNull();
128 return view != nullptr ? view->surfaceOrNull() : nullptr;
129}
130
132{
133 return m_view.get();
134}
135
137{
139 m_view = QOhosView::createForWindow(this, propertiesProvider());
140
141 auto *qWindow = window();
142
143 // HACK
144 // There is no functionality to fetch the initial window status from ohos
145 // We can only listen for the changes - we need to assume sane default for tablets
146 // so assign the default most-likely status of the tablet here.
147 if (m_view->viewType() == QOhosView::ViewType::MainWindow
148 && !QOhosSettings::instance().isWindowPcModeEnabled()
149 && !m_lastWindowStatusType.has_value()) {
150 m_lastWindowStatusType = QOhosWindowProxy::WindowStatusType::FULL_SCREEN;
151 }
152
153 QObject::connect(
154 m_view.get(), &QOhosView::externalContentInteractionDetected,
155 qWindow, &QOhosPlatformWindow::closeAllActivePopups);
156
157 QObject::connect(
158 m_view.get(), &QOhosView::nodeAreaChanged, m_view.get(),
159 [this](QArkUi::QQtEmbeddedWindowNode::NodeAreaInfo event) {
160 if (m_view->viewType() == QOhosView::ViewType::EmbeddedWindow)
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
262 view->setWindowMask(QOhosWindowProxy::WindowMask{region});
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
455void QOhosFloatingWindow::handleWindowDisplayIdChanged(QOhosDisplayInfo::JsDisplayId displayId)
456{
457 setDisplayIdFromOhos(displayId);
458 startAsyncWaitForNodeResizeIfNeeded();
459}
460
461void QOhosFloatingWindow::handleWindowRectChanged(
462 const QOhosWindowProxy::RectChangeOptions &rectChangeOptions)
463{
464 bool needsCloseAllActivePopups = rectChangeOptions.reason == QOhosWindowProxy::RectChangeReason::DRAG_START;
465
466 qCDebug(QtForOhos)
467 << "windowRectChanged window:" << window()
468 << "rect:" << rectChangeOptions.rect
469 << "reason:" << static_cast<int>(rectChangeOptions.reason);
470
471 startAsyncWaitForNodeResizeIfNeeded();
472
473 if (isWindowRotatedByTabletScreenRotation(window(), rectChangeOptions))
474 needsCloseAllActivePopups = true;
475
476 if (needsCloseAllActivePopups)
478}
479
481{
482 if (event->type() == QEvent::WindowUnblocked) {
483 auto deferredActivationEvent =
484 std::exchange(m_activationEventDeferredUntilWindowUnblocked, std::nullopt);
485 const QWindow *windowHoldingFocus = QGuiApplicationPrivate::focus_window;
486 bool noVisibleWindowHoldsFocus =
487 windowHoldingFocus == nullptr || !windowHoldingFocus->isVisible();
488 if (deferredActivationEvent && noVisibleWindowHoldsFocus)
489 handleWindowEvent(*deferredActivationEvent);
490 }
491
492 if (event->type() == QEvent::Timer) {
493 auto *timerEvent = static_cast<QTimerEvent *>(event);
494 if (m_view && timerEvent->timerId() == m_geometryChangeTimer.timerId()) {
495 // nodeAreaInfo() is only valid once the node has reported its first
496 // area. Until then do nothing: m_geometryChangeTimer is a repeating
497 // timer, so it fires again and re-checks. handleNodeResizeEvent()
498 // stops it once a valid area has been applied.
499 if (m_view->isNodeLaidOut())
500 handleNodeResizeEvent(m_view->nodeAreaInfo());
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 const QPoint pos = m_view->viewType() == QOhosView::ViewType::EmbeddedWindow
527 ? areaChangeEvent.parentRelativeOffsetPixels
528 : areaChangeEvent.globalRelativeOffsetPixels;
529 setWindowGeometryFromOhos(QRect(pos, areaChangeEvent.screenGeometryPixels.size()));
530
531 updateSafeAreaMargins();
532}
533
534// Map display-space cutout rects to window-relative margins, each attributed to
535// the nearest window edge.
536static QMargins cutoutMarginsForWindow(const QList<QRect> &cutoutRects, const QRect &windowRect)
537{
538 QMargins margins;
539 for (const QRect &cutout : cutoutRects) {
540 if (cutout.isEmpty() || !cutout.intersects(windowRect))
541 continue;
542 const int distTop = cutout.top() - windowRect.top();
543 const int distBottom = windowRect.bottom() - cutout.bottom();
544 const int distLeft = cutout.left() - windowRect.left();
545 const int distRight = windowRect.right() - cutout.right();
546 int nearest = qMin(qMin(distTop, distBottom), qMin(distLeft, distRight));
547 if (nearest == distTop)
548 margins.setTop(qMax(margins.top(), cutout.bottom() + 1 - windowRect.top()));
549 else if (nearest == distBottom)
550 margins.setBottom(qMax(margins.bottom(), windowRect.bottom() + 1 - cutout.top()));
551 else if (nearest == distLeft)
552 margins.setLeft(qMax(margins.left(), cutout.right() + 1 - windowRect.left()));
553 else
554 margins.setRight(qMax(margins.right(), windowRect.right() + 1 - cutout.left()));
555 }
556 return margins;
557}
558
559void QOhosFloatingWindow::updateSafeAreaMargins()
560{
561 // The system bar and navigation indicator avoid areas are window-relative
562 // and visibility-aware: they report zero when hidden (e.g. in fullscreen).
563 static constexpr QOhosWindowProxy::AvoidAreaType kSafeAreaContributors[] = {
564 QOhosWindowProxy::AvoidAreaType::TYPE_SYSTEM,
566 };
567
568 // Avoid-area sizes are relative to the full window; subtract the inset the
569 // compositor already applies (frame vs. true on-screen content) so a normal
570 // window reports no safe area, matching Android's max(0, inset - offset).
571 // nodeScreenGeometryPixels() is the real content rect; drawableRect lies.
572 const QRect frame = m_view->viewGeometry().frameGeometry;
573 const QRect content = m_view->nodeScreenGeometryPixels();
574 const int alreadyTop = content.top() - frame.top();
575 const int alreadyLeft = content.left() - frame.left();
576 const int alreadyRight = frame.right() - content.right();
577 const int alreadyBottom = frame.bottom() - content.bottom();
578
579 QMargins combined;
580 for (auto type : kSafeAreaContributors) {
581 const QMargins m = m_view->avoidAreaMargins(type);
582 combined.setTop(qMax(combined.top(), qMax(0, m.top() - alreadyTop)));
583 combined.setLeft(qMax(combined.left(), qMax(0, m.left() - alreadyLeft)));
584 combined.setRight(qMax(combined.right(), qMax(0, m.right() - alreadyRight)));
585 combined.setBottom(qMax(combined.bottom(), qMax(0, m.bottom() - alreadyBottom)));
586 }
587
588 // The display cutout is not in the avoid areas; fold it in from
589 // getCutoutInfo() (fetched fresh as it rotates with the display) and report
590 // it even in fullscreen, mapped against the content area.
591 const QMargins cutout = cutoutMarginsForWindow(m_view->displayCutoutRects(), content);
592 combined.setTop(qMax(combined.top(), cutout.top()));
593 combined.setLeft(qMax(combined.left(), cutout.left()));
594 combined.setRight(qMax(combined.right(), cutout.right()));
595 combined.setBottom(qMax(combined.bottom(), cutout.bottom()));
596
597 setSafeAreaMarginsFromOhos(combined);
598}
599
600QT_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.
bool isWindowPcModeEnabled() const
static QOhosSettings & instance()
QOhosSurface * surfaceOrNull() const
void setWindowMask(const QOhosWindowProxy::WindowMask &windowMask)
void lower()
bool startMoving()
void raise()
QtOhosQpa::enums::ohos::window::WindowEventType WindowEventType
QtOhosQpa::enums::ohos::window::RectChangeReason RectChangeReason
QtOhosQpa::enums::ohos::window::AvoidAreaType AvoidAreaType
QtOhosQpa::enums::ohos::window::WindowStatusType WindowStatusType
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)