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
qohosplatformwindow.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 <qohosplatformwindow.h>
5
6#include <QtCore/private/qohoslogger_p.h>
7#include <QtCore/qpointer.h>
8#include <QtGui/private/qguiapplication_p.h>
9#include <QtGui/private/qohoswindowhints_p.h>
10#include <QtGui/private/qwindow_p.h>
11#include <algorithm>
12#include <cmath>
13#include <iterator>
14#include <memory>
15#include <qguiapplication.h>
16#include <qohosdeviceinfo_p.h>
17#include <qohosinputcontext.h>
18#include <qohosinputmethodeventhandler.h>
19#include <qohosjsmain.h>
20#include <qohosplatformintegration.h>
21#include <qohosplatformscreen.h>
22#include <qohosruntimedevicetypeandmode.h>
23#include <qohossettings.h>
24#include <qohosutils.h>
25#include <qpa/qwindowsysteminterface.h>
26#include <render/qohosview.h>
27#include <render/qwindowproxyregistry.h>
28
30
31namespace
32{
33
34constexpr int defaultWindowWidth = 160;
35constexpr int defaultWindowHeight = 160;
36
37QOhosView *getWindowsViewOrNull(QWindow *targetWindow)
38{
39 auto *platformWindow = QOhosPlatformWindow::fromQWindowOrNull(targetWindow);
40 if (platformWindow == nullptr) {
41 qCWarning(QtForOhos, "%s: Target window does not contain PlatformWindow", Q_FUNC_INFO);
42 return nullptr;
43 }
44
45 auto *view = platformWindow->ownedViewOrNull();
46 if (view == nullptr) {
47 qCCritical(QtForOhos, "%s: Target window does not contain a view", Q_FUNC_INFO);
48 return nullptr;
49 }
50
51 return view;
52}
53
54}
55
56const QOhosPropertyDescriptor<QWindow *> QOhosPlatformWindow::subWindowOfTagProperty{"_q_platform_ohos_subWindowOf"};
57const QOhosPropertyDescriptor<bool> QOhosPlatformWindow::mainWindowTagProperty{"_q_platform_ohos_mainWindow"};
58const QOhosPropertyDescriptor<bool> QOhosPlatformWindow::floatWindowTagProperty{QOhosWindowHints::floatWindowKey};
59const QOhosPropertyDescriptor<double> QOhosPlatformWindow::windowCornerRadiusProperty{QOhosWindowHints::cornerRadiusKey};
60const QOhosPropertyDescriptor<bool> QOhosPlatformWindow::windowPrivacyModeSettingProperty{QOhosWindowHints::privacyModeKey};
61const QOhosPropertyDescriptor<QColor> QOhosPlatformWindow::surfaceBackgroundColorProperty{QOhosWindowHints::surfaceBackgroundColorKey};
63const QOhosPropertyDescriptor<bool> QOhosPlatformWindow::windowKeepScreenOnProperty{QOhosWindowHints::keepScreenOnKey};
64const QOhosPropertyDescriptor<bool> QOhosPlatformWindow::windowDragResizableProperty{QOhosWindowHints::dragResizableKey};
65const QOhosPropertyDescriptor<bool> QOhosPlatformWindow::windowFixedSizeStateProperty{"_q_platform_ohos_fixedSizeState"};
66const QOhosPropertyDescriptor<int> QOhosPlatformWindow::windowBrightnessProperty{QOhosWindowHints::brightnessKey};
67const QOhosPropertyDescriptor<int> QOhosPlatformWindow::windowContrastProperty{QOhosWindowHints::contrastKey};
68const QOhosPropertyDescriptor<int> QOhosPlatformWindow::windowSaturationProperty{QOhosWindowHints::saturationKey};
69
73{
74 m_windowFlags = Qt::Widget;
75 m_windowState = window->windowStates();
76 m_windowId = QtOhos::InternalWindowId::generate();
77}
78
79void QOhosPlatformWindow::setGeometry(const QRect &rect)
80{
81 const bool frameTopLeftGiven =
82 qt_window_private(window())->positionPolicy == QWindowPrivate::WindowFrameInclusive;
83 const QMargins margins = frameMargins();
84 const QRect clientRect = frameTopLeftGiven
85 ? rect.translated(margins.left(), margins.top())
86 : rect;
87
88 qOhosPrintfDebug(
89 "%s: pos: %d,%d size: %d,%d",
90 Q_FUNC_INFO,
91 clientRect.x(), clientRect.y(),
92 clientRect.width(), clientRect.height());
93
94 m_lastRequestedWindowFrameGeometry = clientRect.marginsAdded(margins);
95 QPlatformWindow::setGeometry(clientRect);
96}
97
99{
100 QRect availableGeometry = screen()->availableGeometry();
101 return geometry().width() > 0
102 && geometry().height() > 0
103 && availableGeometry.width() > 0
104 && availableGeometry.height() > 0;
105}
106
108{
110 QPlatformWindow::setVisible(visible);
111}
112
113void QOhosPlatformWindow::setCursor(const QCursor &cursor)
114{
115 auto *view = ownedViewOrNull();
116 if (view != nullptr) {
117 m_cursor = cursor;
118 view->setCursor(cursor);
119 }
120}
121
122void QOhosPlatformWindow::setWindowTitle(const QString &title)
123{
124 auto *view = ownedViewOrNull();
125 if (view != nullptr)
126 view->setTitle(title);
127}
128
129void QOhosPlatformWindow::setParent(const QPlatformWindow *newParent)
130{
131 if (newParent != nullptr && newParent->isForeignWindow())
132 qOhosReportFatalErrorAndAbort("Reparenting to foreign windows is not supported");
133
134 m_parent = parent();
135
136 auto *view = ownedViewOrNull();
137
138 if (newParent == nullptr) {
140 return;
141 }
142
143 auto *parentView = static_cast<const QOhosPlatformWindow *>(newParent)->ownedViewOrNull();
144 view->setParentOrReparent(*parentView);
145}
146
148{
149 if (!m_displayId.has_value())
150 return QPlatformWindow::screen();
151
153 auto *platformScreen = screenManager.platformScreenForDisplayIdOrNull(m_displayId.value());
154 if (platformScreen != nullptr)
155 return platformScreen;
156
157 qCWarning(QtForOhos)
158 << Q_FUNC_INFO << "window:" << window()
159 << "display id" << m_displayId.value().value()
160 << "has no platform screen. Returning QWindow associated one.";
161
162 return QPlatformWindow::screen();
163}
164
165void QOhosPlatformWindow::setWindowState(Qt::WindowStates state)
166{
167 if (m_windowState == state)
168 return;
169
170 auto oldWindowState = std::exchange(m_windowState, state);
171 onWindowStateChanged(oldWindowState, m_windowState);
172}
173
174void QOhosPlatformWindow::setWindowFlags(Qt::WindowFlags flags)
175{
176 static QSet<Qt::WindowType> disableFocusableWindowTypes{Qt::ToolTip, Qt::Popup};
177
178 auto *qWindow = window();
179 auto correctedFlags = flags;
180 bool ohosOverrideDisableFocusableFeatures = disableFocusableWindowTypes.contains(qWindow->type());
181 if (ohosOverrideDisableFocusableFeatures) {
182 qCDebug(
183 QtForOhos,
184 "Setting Qt::WindowDoesNotAcceptFocus flag on window %s(%s) because of its type",
185 qPrintable(internalWindowId().toString()),
186 qPrintable(qWindow->objectName()));
187 correctedFlags.setFlag(Qt::WindowDoesNotAcceptFocus, true);
188 }
189
190 if (correctedFlags.testFlag(Qt::FramelessWindowHint)) {
191 correctedFlags.setFlag(Qt::WindowMaximizeButtonHint, false);
192 correctedFlags.setFlag(Qt::WindowMinimizeButtonHint, false);
193 correctedFlags.setFlag(Qt::WindowCloseButtonHint, false);
194 } else if (!correctedFlags.testFlag(Qt::CustomizeWindowHint)) {
195 correctedFlags.setFlag(Qt::WindowMaximizeButtonHint, true);
196 correctedFlags.setFlag(Qt::WindowMinimizeButtonHint, true);
197 correctedFlags.setFlag(Qt::WindowCloseButtonHint, true);
198 }
199
200 auto previousWindowFlags = std::exchange(m_windowFlags, correctedFlags);
201 onWindowFlagsChanged(previousWindowFlags, m_windowFlags);
202}
203
205{
206 return m_windowFlags;
207}
208
210{
211 return static_cast<QOhosPlatformScreen *>(screen());
212}
213
215{
216 return m_lastRequestedWindowFrameGeometry;
217}
218
220{
221 auto *view = ownedViewOrNull();
222 if (view == nullptr)
223 return;
224
225 setWindowOrWidgetProperty<bool, &windowFixedSizeStateProperty>(
226 window(), windowMinimumSize() == windowMaximumSize());
227
228 view->setSizeLimits(windowMinimumSize(), windowMaximumSize());
229}
230
232{
233 return m_exposed;
234}
235
237{
238 return m_windowId;
239}
240
241std::optional<double> QOhosPlatformWindow::windowId() const
242{
243 auto internalId = internalWindowId();
244 auto jsWinId = QWindowProxyRegistry::instance().tryMapInternalWindowIdToJsWindowId(internalId);
245 if (!jsWinId.has_value())
246 return {};
247
248 qOhosPrintfInfo(
249 "PlatformWindow WIID: %s is returning JsWindowId: %f to the user",
250 qPrintable(internalId.toString()), jsWinId.value().value());
251
252 return jsWinId.value().value();
253}
254
256{
257 return window()->isTopLevel();
258}
259
261{
262 constexpr Qt::WindowType showWithoutDecorationWindowTypes[] = {
263 Qt::WindowType::Popup,
264 Qt::WindowType::SplashScreen,
265 Qt::WindowType::ToolTip,
266 };
267
268 auto *qWindow = window();
269 bool showWithoutDecoration =
270 qWindow->parent() != nullptr
271 || std::find(
272 std::begin(showWithoutDecorationWindowTypes),
273 std::end(showWithoutDecorationWindowTypes),
274 qWindow->type()) != std::end(showWithoutDecorationWindowTypes)
275 || windowFlags().testFlag(Qt::WindowType::FramelessWindowHint)
276 || floatWindowTagValueOrFalse();
277
278 return showWithoutDecoration
281}
282
284{
285 if (m_optFrameMargins)
286 return *m_optFrameMargins;
287
288 // TODO: Read this information from the system in the future
289 // getWindowDecorHeight: https://developer.huawei.com/consumer/en/doc/harmonyos-references/arkts-apis-window-window#getwindowdecorheight11
290 // WindowProperties.drawableRect: https://developer.huawei.com/consumer/en/doc/harmonyos-references/arkts-apis-window-i#windowproperties
291 // Check if its viable and adapt the frameGeometry code in window to use getWIndowDecorHeight.
292
293 const auto *screen = platformScreen();
294 if (screen == nullptr)
295 return QMargins{};
296
298 // https://gitcode.com/openharmony/window_window_manager/tree/master/utils/include/wm_common_inner.h
299 constexpr auto predefinedWindowTitleBarHeight = 37;
300 const int titlebarHeightPixels = std::round(predefinedWindowTitleBarHeight * screen->pixelScalingCoefficient());
301 return QMargins{0, titlebarHeightPixels, 0, 0};
302 }
303
304 return QMargins{};
305}
306
308{
309 return nullptr;
310}
311
312QOhosPlatformWindow *QOhosPlatformWindow::fromQWindowOrNull(QWindow *window)
313{
314 auto *platformWindow = window->handle();
315 return platformWindow != nullptr
316 ? static_cast<QOhosPlatformWindow *>(platformWindow)
317 : nullptr;
318}
319
320QOhosPlatformWindow *QOhosPlatformWindow::fromQWindow(QWindow *window)
321{
322 QOhosPlatformWindow *platformWindow = fromQWindowOrNull(window);
323 if (platformWindow == nullptr)
324 qOhosReportFatalErrorAndAbort("QWindow %s does not have QPlatformWindow", qPrintable(window->objectName()));
325 return platformWindow;
326}
327
328void QOhosPlatformWindow::tagWindowOrWidgetAsSubWindowOf(QObject *windowOrWidgetToTag, QWindow *targetMainWindow)
329{
330 setWindowOrWidgetProperty<QWindow *, &subWindowOfTagProperty>(windowOrWidgetToTag, targetMainWindow);
331}
332
333void QOhosPlatformWindow::tagWindowOrWidgetAsMainWindow(QObject *windowOrWidgetToTag, bool forceMainWindow)
334{
335 setWindowOrWidgetProperty<bool, &mainWindowTagProperty>(windowOrWidgetToTag, forceMainWindow);
336}
337
338void QOhosPlatformWindow::tagWindowOrWidgetAsFloatWindow(
339 QObject *windowOrWidgetToTag, bool showAsFloatWindow)
340{
341 setWindowOrWidgetProperty<bool, &floatWindowTagProperty>(windowOrWidgetToTag, showAsFloatWindow);
342}
343
345{
346 auto *tagValue = QOhosPlatformWindow::getWindowOrWidgetAsSubWindowOfTagValue(window());
347 const auto &allWindows = QGuiApplicationPrivate::window_list;
348 bool tagValueValid = tagValue != nullptr && allWindows.contains(tagValue);
349 qCDebug(
350 QtForOhos, "Window %s(%s) - subWindowOf tag %s value: %p",
351 qPrintable(internalWindowId().toString()), qPrintable(window()->objectName()),
352 tagValueValid ? "valid" : "invalid",
353 tagValue);
354
355 return tagValueValid ? tagValue : nullptr;
356}
357
359{
360 return m_propertiesStore.tryGetProperty<bool, &mainWindowTagProperty>().value_or(false);
361}
362
364{
365 const auto showWithoutActivating = window()->property("_q_showWithoutActivating");
366 return showWithoutActivating.isValid() && showWithoutActivating.toBool() && window()->modality() == Qt::NonModal;
367}
368
369QWindow *QOhosPlatformWindow::getWindowOrWidgetAsSubWindowOfTagValue(QObject *windowOrWidget)
370{
371 return tryGetWindowOrWidgetProperty<QWindow *, &subWindowOfTagProperty>(windowOrWidget).value_or(nullptr);
372}
373
374Qt::WindowFlags QOhosPlatformWindow::platformWindowFlagsForQWindow(QWindow *window)
375{
376 auto *platformWindow = QOhosPlatformWindow::fromQWindow(window);
377 return platformWindow->windowFlags();
378}
379
380bool QOhosPlatformWindow::isEmbeddedWindow(QWindow *window)
381{
382 auto *platformWindow = QOhosPlatformWindow::fromQWindowOrNull(window);
383 auto *view = platformWindow != nullptr ? platformWindow->ownedViewOrNull() : nullptr;
384 return view != nullptr && view->viewType() == QOhosView::ViewType::EmbeddedWindow;
385}
386
388{
389 auto windows = qGuiApp->allWindows();
390 for (auto *window : windows) {
391 if (window->type() == Qt::Popup && window->isVisible())
392 QWindowSystemInterface::handleCloseEvent(window);
393 }
394}
395
397{
398 return nullptr;
399}
400
402{
403 auto *qWindow = window();
404
405 setWindowFlags(qWindow->flags());
406
407 auto initialWindowGeom = windowGeometry();
408 auto initialGeom = initialGeometry(window(), initialWindowGeom, defaultWindowWidth, defaultWindowHeight);
409 QOhosPlatformWindow::setGeometry(initialGeom);
410
411 m_parent = parent();
412}
413
415{
416 return m_windowState;
417}
418
419void QOhosPlatformWindow::setWindowStateFromOhos(Qt::WindowStates state)
420{
421 if (m_lastWindowState != state) {
422 m_windowState = state;
423 m_lastWindowState = state;
424 QWindowSystemInterface::handleWindowStateChanged(window(), m_windowState);
425 }
426}
427
429{
430 if (windowFlags().testFlag(Qt::WindowDoesNotAcceptFocus))
431 return;
432
433 auto *view = ownedViewOrNull();
434 if (view != nullptr)
436}
437
438void QOhosPlatformWindow::setWindowMarginsFromOhos(const QMargins &margins)
439{
440 bool marginsChanged = !m_optFrameMargins || *m_optFrameMargins != margins;
441 if (!marginsChanged)
442 return;
443
444 if (m_optFrameMargins) {
445 *m_optFrameMargins = margins;
446 } else {
447 m_optFrameMargins = std::make_unique<QMargins>(margins);
448 }
449
450 qCDebug(QtForOhos) << "Window margins changed: " << *m_optFrameMargins;
451}
452
454{
455 return m_safeAreaMargins;
456}
457
459{
460 if (m_safeAreaMargins == margins)
461 return;
462
463 m_safeAreaMargins = margins;
464 qCDebug(QtForOhos) << "Safe area margins changed: " << m_safeAreaMargins;
466}
467
469{
470 m_exposed = exposed;
471 sendExposeUpdate();
472}
473
475{
476 auto *qWindow = window();
477 auto *view = ownedViewOrNull();
478 bool needsGeometryUpdate =
479 view != nullptr
480 && view->viewType() == QOhosView::ViewType::EmbeddedWindow
481 && window()->isVisible();
482 if (needsGeometryUpdate) {
483 auto scaledGeometry = window()->geometry();
484 qWindow->setGeometry(scaledGeometry);
486 }
487
488 qWindow->requestUpdate();
489 setWindowGeometryFromOhos(windowGeometry());
490}
491
492std::shared_ptr<void> QOhosPlatformWindow::setSurfaceConsumer(
493 QWindow *targetWindow, QObject *surfaceConsumerContext,
494 std::function<void(std::optional<void *>)> surfaceConsumer)
495{
496 qCDebug(
497 QtForOhos,
498 "%s: %s",
499 Q_FUNC_INFO,
500 surfaceConsumerContext->metaObject()->className());
501
502 auto *view = getWindowsViewOrNull(targetWindow);
503 if (view == nullptr)
504 return nullptr;
505
506 if (surfaceConsumerContext->thread() != view->thread() || view->thread() != QThread::currentThread()) {
507 qOhosReportFatalErrorAndAbort(
508 "%s: inter-thread surface consumer connection is not supported", Q_FUNC_INFO);
509 }
510
511 auto sharedSurfaceConsumer = QtOhos::moveToSharedPtr(std::move(surfaceConsumer));
512
513 auto *surface = view->surfaceOrNull();
514 if (surface != nullptr) {
515 QMetaObject::invokeMethod(
516 surfaceConsumerContext,
517 [weakSurfaceConsumer = std::weak_ptr<decltype(surfaceConsumer)>(sharedSurfaceConsumer),
518 targetWindow = QPointer<QWindow>(targetWindow)]() {
519 auto sharedSurfaceConsumer = weakSurfaceConsumer.lock();
520 if (!sharedSurfaceConsumer || targetWindow == nullptr)
521 return;
522
523 auto *view = getWindowsViewOrNull(targetWindow);
524 if (view == nullptr)
525 return;
526
527 auto *surface = view->surfaceOrNull();
528 (*sharedSurfaceConsumer)(
529 surface != nullptr
530 ? std::optional<void *>(surface->nativeWindow())
531 : std::nullopt);
532 },
533 Qt::QueuedConnection);
534 }
535
536 auto surfaceStatusChangedConnectionHandle = QObject::connect(
537 view, &QOhosView::surfaceStatusChanged, surfaceConsumerContext,
538 [view = QPointer<QOhosView>(view), sharedSurfaceConsumer](const std::optional<QSize> &) {
539 if (view == nullptr)
540 return;
541 auto *surface = view->surfaceOrNull();
542 (*sharedSurfaceConsumer)(
543 surface != nullptr
544 ? std::optional<void *>(surface->nativeWindow())
545 : std::nullopt);
546 });
547
548 if (!surfaceStatusChangedConnectionHandle) {
549 qCCritical(
550 QtForOhos,
551 "%s: Connection between ohos view and surface consumer context failed",
552 Q_FUNC_INFO);
553 return nullptr;
554 }
555
556 auto viewDestroyedConnectionHandle = QObject::connect(
557 view, &QObject::destroyed, surfaceConsumerContext,
558 [sharedSurfaceConsumer]() {
559 (*sharedSurfaceConsumer)({});
560 },
561 Qt::QueuedConnection);
562
563 if (!viewDestroyedConnectionHandle) {
564 qCCritical(
565 QtForOhos,
566 "%s: Connecting view destroyed signal to surface consumer context failed",
567 Q_FUNC_INFO);
568 return nullptr;
569 }
570
571 return QtOhos::makeDestroyNotifier(
572 [surfaceStatusChangedConnectionHandle = std::move(surfaceStatusChangedConnectionHandle),
573 viewDestroyedConnectionHandle = std::move(viewDestroyedConnectionHandle)] () mutable {
574 QObject::disconnect(surfaceStatusChangedConnectionHandle);
575 QObject::disconnect(viewDestroyedConnectionHandle);
576 });
577}
578
580{
581 return m_propertiesStore.tryGetProperty<bool, &floatWindowTagProperty>().value_or(false);
582}
583
585{
586 return ownedViewOrNull() != nullptr ? ownedViewOrNull()->makeSnapshot() : QPixmap();
587}
588
589void QOhosPlatformWindow::setDisplayIdFromOhos(std::optional<QOhosDisplayInfo::JsDisplayId> displayId)
590{
591 if (m_displayId != displayId) {
592 m_displayId = displayId;
593
594 qCDebug(QtForOhos)
595 << "Screen changed - window:" << window()
596 << "displayId:" << (displayId.has_value()
597 ? QString::number(displayId.value().value())
598 : QString::fromUtf8("<NO DISPLAY>"));
599
600 QOhosPlatformScreen *screen = m_displayId.has_value()
601 ? QOhosPlatformIntegration::instance()
602 ->screenManager()->platformScreenForDisplayIdOrNull(m_displayId.value())
603 : nullptr;
604
605 QWindowSystemInterface::handleWindowScreenChanged(
606 window(),
607 screen != nullptr
608 ? screen->screen()
609 : nullptr);
610 }
611}
612
613void QOhosPlatformWindow::setWindowGeometryFromOhos(const QRect &nativeWindowDrawGeometry)
614{
615 qCDebug(QtForOhos) << "window:" << window() << "geometry change to:" << nativeWindowDrawGeometry;
616 QWindowSystemInterface::handleGeometryChange(window(), nativeWindowDrawGeometry);
617
618 if (isExposed())
619 sendExposeUpdate();
620}
621
627
629{
630 if (active) {
631 auto *ohosInputContext = qobject_cast<QOhosInputContext *>(QOhosPlatformIntegration::instance()->inputContext());
632 if (ohosInputContext != nullptr) {
633 ohosInputContext->setLastInputTypeToTriggerSoftKeyboard(QOhosInputContext::RequestKeyboardReason::NONE);
634 }
635 } else {
636 if (QOhosPlatformIntegration::instance()->inputContext()->isInputPanelVisible())
637 QOhosPlatformIntegration::instance()->inputContext()->hideInputPanel();
638 }
639}
640
644
648
650{
651 return QOhosPropertiesProvider(m_propertiesStore);
652}
653
655{
656 qCDebug(QtForOhos) << Q_FUNC_INFO << "window:" << window() << "grab:" << grab;
657
659 if (grab)
660 inputHandler->grabMouse(window());
661 else
662 inputHandler->stopAnyMouseGrab();
663
664 return true;
665}
666
668{
669 qCDebug(QtForOhos) << Q_FUNC_INFO << "window:" << window() << "grab:" << grab;
670
672 if (grab)
673 inputHandler->grabKeyboard(window());
674 else
675 inputHandler->stopAnyKeyboardGrab();
676
677 return true;
678}
679
681{
682 auto platformWindowFlags = QOhosPlatformWindow::platformWindowFlagsForQWindow(window());
683 return !platformWindowFlags.testFlag(Qt::WindowDoesNotAcceptFocus);
684}
685
687{
688 auto platformWindowFlags = QOhosPlatformWindow::platformWindowFlagsForQWindow(window());
689 return !platformWindowFlags.testFlag(Qt::WindowTransparentForInput);
690}
691
693{
694 switch (event->type()) {
695 case QEvent::ApplicationPaletteChange:
696 if (auto *ohosView = ownedViewOrNull())
698 break;
699 case QEvent::DynamicPropertyChange: {
700 auto propertyName = static_cast<QDynamicPropertyChangeEvent *>(event)->propertyName();
701 m_propertiesStore.notifyPropertyWrite(propertyName);
702 break;
703 }
704 default: break;
705 }
706
707 return QPlatformWindow::windowEvent(event);
708}
709
710bool QOhosPlatformWindow::isWindowBeingClosedOrDestroyed(QWindow *window)
711{
712 QWindowPrivate *windowPriv = qt_window_private(window);
713 return windowPriv && (windowPriv->inClose || windowPriv->visibilityOnDestroy);
714}
715
716void QOhosPlatformWindow::sendExposeUpdate()
717{
718 auto exposedSize = m_exposed
719 ? geometry().size()
720 : QSize();
721
722 QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), exposedSize)));
723}
724
725QT_END_NAMESPACE
QOhosScreenManager * screenManager() const
static QOhosPlatformIntegration * instance()
QOhosInputMethodEventHandler * inputMethodEventHandler() const
static const QOhosPropertyDescriptor< bool > windowKeepScreenOnProperty
static const QOhosPropertyDescriptor< QColor > surfaceBackgroundColorProperty
void setWindowTitle(const QString &title) override
Reimplement to set the window title to title.
QOhosPlatformScreen * platformScreen() const
bool mainWindowTagValueOrFalse() const
Qt::WindowStates windowStates() const
void setDisplayIdFromOhos(std::optional< QOhosDisplayInfo::JsDisplayId > displayId)
bool setMouseGrabEnabled(bool grab) override
void setWindowStateFromOhos(Qt::WindowStates state)
static const QOhosPropertyDescriptor< int > windowBrightnessProperty
static const QOhosPropertyDescriptor< bool > mainWindowTagProperty
static const QOhosPropertyDescriptor< QWindow * > subWindowOfTagProperty
void setGeometry(const QRect &rect) override
This function is called by Qt whenever a window is moved or resized using the QWindow API.
bool setKeyboardGrabEnabled(bool grab) override
static const QOhosPropertyDescriptor< bool > windowPrivacyModeSettingProperty
bool windowEvent(QEvent *event) override
Reimplement this method to be able to do any platform specific event handling.
static const QOhosPropertyDescriptor< double > windowCornerRadiusProperty
QRect lastRequestedWindowFrameGeometry() const
QMargins safeAreaMargins() const override
The safe area margins of a window represent the area that is safe to place content within,...
static const QOhosPropertyDescriptor< int > windowSaturationProperty
void setExposedFromOhos(bool exposed)
static const QOhosPropertyDescriptor< int > windowContrastProperty
QOhosPropertiesProvider propertiesProvider()
static const QOhosPropertyDescriptor< bool > floatWindowTagProperty
void setVisible(bool visible) override
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false.
static const QOhosPropertyDescriptor< bool > windowDragResizableProperty
virtual void onWindowFlagsChanged(Qt::WindowFlags previousWindowFlags, Qt::WindowFlags currentWindowFlags)
QtOhos::InternalWindowId internalWindowId() const
void propagateSizeHints() override
Reimplement to propagate the size hints of the QWindow.
virtual QOhosSurface * ownedSurfaceOrNull() const
virtual void onWindowStateChanged(Qt::WindowStates oldWindowState, Qt::WindowStates currentWindowState)
void setParent(const QPlatformWindow *newParent) override
This function is called to enable native child window in QPA.
QOhosPlatformWindow(QWindow *window)
void setCursor(const QCursor &cursor)
bool shouldDisplayAsOhosWindow() const
static const QOhosPropertyDescriptor< int > nativeNodeRenderFitPolicyHintProperty
void setWindowGeometryFromOhos(const QRect &nativeWindowDrawGeometry)
std::optional< double > windowId() const override
QMargins frameMargins() const override
void initialize() override
Called as part of QWindow::create(), after constructing the window.
void setSafeAreaMarginsFromOhos(const QMargins &margins)
QPlatformScreen * screen() const override
void setWindowFlags(Qt::WindowFlags flags) override
Requests setting the window flags of this surface to flags.
bool floatWindowTagValueOrFalse() const
void setWindowState(Qt::WindowStates state) override
Requests setting the window state of this surface to type.
void notifyInputSystemsWindowActiveStatusChanged(bool active)
static const QOhosPropertyDescriptor< bool > windowFixedSizeStateProperty
bool isExposed() const final
Returns if this window is exposed in the windowing system.
void requestActivateWindow() override
Reimplement to let Qt be able to request activation/focus for a window.
DecorationPreset decorationPreset() const
QWindow * validSubWindowOfTagValueOrNull() const
Qt::WindowFlags windowFlags() const
bool shouldShowWindowWithoutActivating() const
virtual QOhosView * ownedViewOrNull() const
void setWindowMarginsFromOhos(const QMargins &margins)
QOhosPlatformScreen * platformScreenForDisplayIdOrNull(QOhosDisplayInfo::JsDisplayId displayId) const
void setParentOrReparent(QOhosView &parentView)
void requestActivate()
void tryDetachFromEmbeddedParent()
void forceGeometryUpdate()
void handlePaletteChange()
QRect window() const
Returns the window rectangle.
static QWindowProxyRegistry & instance()
Combined button and popup list for selecting options.
constexpr int defaultWindowHeight
QOhosView * getWindowsViewOrNull(QWindow *targetWindow)
constexpr int defaultWindowWidth
#define qGuiApp