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#include <private/qwindow_p.h>
29#include <utility>
30
32
33namespace
34{
35
36constexpr int defaultWindowWidth = 160;
37constexpr int defaultWindowHeight = 160;
38
39QOhosView *getWindowsViewOrNull(QWindow *targetWindow)
40{
41 auto *platformWindow = QOhosPlatformWindow::fromQWindowOrNull(targetWindow);
42 if (platformWindow == nullptr) {
43 qCWarning(QtForOhos, "%s: Target window does not contain PlatformWindow", Q_FUNC_INFO);
44 return nullptr;
45 }
46
47 auto *view = platformWindow->ownedViewOrNull();
48 if (view == nullptr) {
49 qCCritical(QtForOhos, "%s: Target window does not contain a view", Q_FUNC_INFO);
50 return nullptr;
51 }
52
53 return view;
54}
55
56}
57
58const QOhosPropertyDescriptor<QWindow *> QOhosPlatformWindow::subWindowOfTagProperty{"_q_platform_ohos_subWindowOf"};
59const QOhosPropertyDescriptor<bool> QOhosPlatformWindow::mainWindowTagProperty{"_q_platform_ohos_mainWindow"};
60const QOhosPropertyDescriptor<bool> QOhosPlatformWindow::floatWindowTagProperty{QOhosWindowHints::floatWindowKey};
61const QOhosPropertyDescriptor<double> QOhosPlatformWindow::windowCornerRadiusProperty{QOhosWindowHints::cornerRadiusKey};
62const QOhosPropertyDescriptor<bool> QOhosPlatformWindow::windowPrivacyModeSettingProperty{QOhosWindowHints::privacyModeKey};
63const QOhosPropertyDescriptor<QColor> QOhosPlatformWindow::surfaceBackgroundColorProperty{QOhosWindowHints::surfaceBackgroundColorKey};
65const QOhosPropertyDescriptor<bool> QOhosPlatformWindow::windowKeepScreenOnProperty{QOhosWindowHints::keepScreenOnKey};
66const QOhosPropertyDescriptor<bool> QOhosPlatformWindow::windowDragResizableProperty{QOhosWindowHints::dragResizableKey};
67const QOhosPropertyDescriptor<bool> QOhosPlatformWindow::windowFixedSizeStateProperty{"_q_platform_ohos_fixedSizeState"};
68const QOhosPropertyDescriptor<int> QOhosPlatformWindow::windowBrightnessProperty{QOhosWindowHints::brightnessKey};
69const QOhosPropertyDescriptor<int> QOhosPlatformWindow::windowContrastProperty{QOhosWindowHints::contrastKey};
70const QOhosPropertyDescriptor<int> QOhosPlatformWindow::windowSaturationProperty{QOhosWindowHints::saturationKey};
71
75{
76 m_windowFlags = Qt::Widget;
77 m_windowState = window->windowStates();
78 m_windowId = QtOhos::InternalWindowId::generate();
79}
80
81void QOhosPlatformWindow::setGeometry(const QRect &rect)
82{
83 const bool frameTopLeftGiven =
84 qt_window_private(window())->positionPolicy == QWindowPrivate::WindowFrameInclusive;
85 const QMargins margins = frameMargins();
86 const QRect clientRect = frameTopLeftGiven
87 ? rect.translated(margins.left(), margins.top())
88 : rect;
89
90 qOhosPrintfDebug(
91 "%s: pos: %d,%d size: %d,%d",
92 Q_FUNC_INFO,
93 clientRect.x(), clientRect.y(),
94 clientRect.width(), clientRect.height());
95
96 m_lastRequestedWindowFrameGeometry = clientRect.marginsAdded(margins);
97 QPlatformWindow::setGeometry(clientRect);
98}
99
101{
102 QRect availableGeometry = screen()->availableGeometry();
103 return geometry().width() > 0
104 && geometry().height() > 0
105 && availableGeometry.width() > 0
106 && availableGeometry.height() > 0;
107}
108
110{
112 QPlatformWindow::setVisible(visible);
113}
114
115void QOhosPlatformWindow::setCursor(const QCursor &cursor)
116{
117 auto *view = ownedViewOrNull();
118 if (view != nullptr) {
119 m_cursor = cursor;
120 view->setCursor(cursor);
121 }
122}
123
124void QOhosPlatformWindow::setWindowTitle(const QString &title)
125{
126 auto *view = ownedViewOrNull();
127 if (view != nullptr)
128 view->setTitle(title);
129}
130
131void QOhosPlatformWindow::setParent(const QPlatformWindow *newParent)
132{
133 if (newParent != nullptr && newParent->isForeignWindow())
134 qOhosReportFatalErrorAndAbort("Reparenting to foreign windows is not supported");
135
136 m_parent = parent();
137
138 auto *view = ownedViewOrNull();
139
140 if (newParent == nullptr) {
142 return;
143 }
144
145 auto *parentView = static_cast<const QOhosPlatformWindow *>(newParent)->ownedViewOrNull();
146 view->setParentOrReparent(*parentView);
147}
148
150{
151 if (!m_displayId.has_value())
152 return QPlatformWindow::screen();
153
155 auto *platformScreen = screenManager.platformScreenForDisplayIdOrNull(m_displayId.value());
156 if (platformScreen != nullptr)
157 return platformScreen;
158
159 qCWarning(QtForOhos)
160 << Q_FUNC_INFO << "window:" << window()
161 << "display id" << m_displayId.value().value()
162 << "has no platform screen. Returning QWindow associated one.";
163
164 return QPlatformWindow::screen();
165}
166
167void QOhosPlatformWindow::setWindowState(Qt::WindowStates state)
168{
169 if (m_windowState == state)
170 return;
171
172 auto oldWindowState = std::exchange(m_windowState, state);
173 onWindowStateChanged(oldWindowState, m_windowState);
174}
175
176void QOhosPlatformWindow::setWindowFlags(Qt::WindowFlags flags)
177{
178 static QSet<Qt::WindowType> disableFocusableWindowTypes{Qt::ToolTip, Qt::Popup};
179
180 auto *qWindow = window();
181 auto correctedFlags = flags;
182 bool ohosOverrideDisableFocusableFeatures = disableFocusableWindowTypes.contains(qWindow->type());
183 if (ohosOverrideDisableFocusableFeatures) {
184 qCDebug(
185 QtForOhos,
186 "Setting Qt::WindowDoesNotAcceptFocus flag on window %s(%s) because of its type",
187 qPrintable(internalWindowId().toString()),
188 qPrintable(qWindow->objectName()));
189 correctedFlags.setFlag(Qt::WindowDoesNotAcceptFocus, true);
190 }
191
192 if (correctedFlags.testFlag(Qt::FramelessWindowHint)) {
193 correctedFlags.setFlag(Qt::WindowMaximizeButtonHint, false);
194 correctedFlags.setFlag(Qt::WindowMinimizeButtonHint, false);
195 correctedFlags.setFlag(Qt::WindowCloseButtonHint, false);
196 } else if (!correctedFlags.testFlag(Qt::CustomizeWindowHint)) {
197 correctedFlags.setFlag(Qt::WindowMaximizeButtonHint, true);
198 correctedFlags.setFlag(Qt::WindowMinimizeButtonHint, true);
199 correctedFlags.setFlag(Qt::WindowCloseButtonHint, true);
200 }
201
202 auto previousWindowFlags = std::exchange(m_windowFlags, correctedFlags);
203 onWindowFlagsChanged(previousWindowFlags, m_windowFlags);
204}
205
207{
208 return m_windowFlags;
209}
210
212{
213 return static_cast<QOhosPlatformScreen *>(screen());
214}
215
217{
218 return m_lastRequestedWindowFrameGeometry;
219}
220
222{
223 auto *view = ownedViewOrNull();
224 if (view == nullptr)
225 return;
226
227 setWindowOrWidgetProperty<bool, &windowFixedSizeStateProperty>(
228 window(), windowMinimumSize() == windowMaximumSize());
229
230 view->setSizeLimits(windowMinimumSize(), windowMaximumSize());
231}
232
234{
235 return m_exposed;
236}
237
239{
240 return m_windowId;
241}
242
243std::optional<double> QOhosPlatformWindow::windowId() const
244{
245 auto internalId = internalWindowId();
246 auto jsWinId = QWindowProxyRegistry::instance().tryMapInternalWindowIdToJsWindowId(internalId);
247 if (!jsWinId.has_value())
248 return {};
249
250 qOhosPrintfInfo(
251 "PlatformWindow WIID: %s is returning JsWindowId: %f to the user",
252 qPrintable(internalId.toString()), jsWinId.value().value());
253
254 return jsWinId.value().value();
255}
256
258{
259 return window()->isTopLevel();
260}
261
263{
264 constexpr Qt::WindowType showWithoutDecorationWindowTypes[] = {
265 Qt::WindowType::Popup,
266 Qt::WindowType::SplashScreen,
267 Qt::WindowType::ToolTip,
268 };
269
270 auto *qWindow = window();
271 bool showWithoutDecoration =
272 qWindow->parent() != nullptr
273 || std::find(
274 std::begin(showWithoutDecorationWindowTypes),
275 std::end(showWithoutDecorationWindowTypes),
276 qWindow->type()) != std::end(showWithoutDecorationWindowTypes)
277 || windowFlags().testFlag(Qt::WindowType::FramelessWindowHint)
278 || floatWindowTagValueOrFalse();
279
280 return showWithoutDecoration
283}
284
286{
287 if (m_optFrameMargins)
288 return *m_optFrameMargins;
289
290 // TODO: Read this information from the system in the future
291 // getWindowDecorHeight: https://developer.huawei.com/consumer/en/doc/harmonyos-references/arkts-apis-window-window#getwindowdecorheight11
292 // WindowProperties.drawableRect: https://developer.huawei.com/consumer/en/doc/harmonyos-references/arkts-apis-window-i#windowproperties
293 // Check if its viable and adapt the frameGeometry code in window to use getWIndowDecorHeight.
294
295 const auto *screen = platformScreen();
296 if (screen == nullptr)
297 return QMargins{};
298
300 // https://gitcode.com/openharmony/window_window_manager/tree/master/utils/include/wm_common_inner.h
301 constexpr auto predefinedWindowTitleBarHeight = 37;
302 const int titlebarHeightPixels = std::round(predefinedWindowTitleBarHeight * screen->pixelScalingCoefficient());
303 return QMargins{0, titlebarHeightPixels, 0, 0};
304 }
305
306 return QMargins{};
307}
308
310{
311 return nullptr;
312}
313
314QOhosPlatformWindow *QOhosPlatformWindow::fromQWindowOrNull(QWindow *window)
315{
316 auto *platformWindow = window->handle();
317 return platformWindow != nullptr
318 ? static_cast<QOhosPlatformWindow *>(platformWindow)
319 : nullptr;
320}
321
322QOhosPlatformWindow *QOhosPlatformWindow::fromQWindow(QWindow *window)
323{
324 QOhosPlatformWindow *platformWindow = fromQWindowOrNull(window);
325 if (platformWindow == nullptr)
326 qOhosReportFatalErrorAndAbort("QWindow %s does not have QPlatformWindow", qPrintable(window->objectName()));
327 return platformWindow;
328}
329
330void QOhosPlatformWindow::tagWindowOrWidgetAsSubWindowOf(QObject *windowOrWidgetToTag, QWindow *targetMainWindow)
331{
332 setWindowOrWidgetProperty<QWindow *, &subWindowOfTagProperty>(windowOrWidgetToTag, targetMainWindow);
333}
334
335void QOhosPlatformWindow::tagWindowOrWidgetAsMainWindow(QObject *windowOrWidgetToTag, bool forceMainWindow)
336{
337 setWindowOrWidgetProperty<bool, &mainWindowTagProperty>(windowOrWidgetToTag, forceMainWindow);
338}
339
340void QOhosPlatformWindow::tagWindowOrWidgetAsFloatWindow(
341 QObject *windowOrWidgetToTag, bool showAsFloatWindow)
342{
343 setWindowOrWidgetProperty<bool, &floatWindowTagProperty>(windowOrWidgetToTag, showAsFloatWindow);
344}
345
347{
348 auto *tagValue = QOhosPlatformWindow::getWindowOrWidgetAsSubWindowOfTagValue(window());
349 const auto &allWindows = QGuiApplicationPrivate::window_list;
350 bool tagValueValid = tagValue != nullptr && allWindows.contains(tagValue);
351 qCDebug(
352 QtForOhos, "Window %s(%s) - subWindowOf tag %s value: %p",
353 qPrintable(internalWindowId().toString()), qPrintable(window()->objectName()),
354 tagValueValid ? "valid" : "invalid",
355 tagValue);
356
357 return tagValueValid ? tagValue : nullptr;
358}
359
361{
362 return m_propertiesStore.tryGetProperty<bool, &mainWindowTagProperty>().value_or(false);
363}
364
366{
367 const auto showWithoutActivating = window()->property("_q_showWithoutActivating");
368 return showWithoutActivating.isValid() && showWithoutActivating.toBool() && window()->modality() == Qt::NonModal;
369}
370
371QWindow *QOhosPlatformWindow::getWindowOrWidgetAsSubWindowOfTagValue(QObject *windowOrWidget)
372{
373 return tryGetWindowOrWidgetProperty<QWindow *, &subWindowOfTagProperty>(windowOrWidget).value_or(nullptr);
374}
375
376Qt::WindowFlags QOhosPlatformWindow::platformWindowFlagsForQWindow(QWindow *window)
377{
378 auto *platformWindow = QOhosPlatformWindow::fromQWindow(window);
379 return platformWindow->windowFlags();
380}
381
383{
384 auto windows = qGuiApp->allWindows();
385 for (auto *window : windows) {
386 if (window->type() == Qt::Popup && window->isVisible())
387 QWindowSystemInterface::handleCloseEvent(window);
388 }
389}
390
392{
393 return nullptr;
394}
395
397{
398 auto *qWindow = window();
399
400 setWindowFlags(qWindow->flags());
401
402 auto initialWindowGeom = windowGeometry();
403 auto initialGeom = initialGeometry(window(), initialWindowGeom, defaultWindowWidth, defaultWindowHeight);
404 m_lastRequestedWindowFrameGeometry = initialGeom;
405 QPlatformWindow::setGeometry(initialGeom);
406
407 m_parent = parent();
408}
409
411{
412 return m_windowState;
413}
414
415void QOhosPlatformWindow::setWindowStateFromOhos(Qt::WindowStates state)
416{
417 if (m_lastWindowState != state) {
418 m_windowState = state;
419 m_lastWindowState = state;
420 QWindowSystemInterface::handleWindowStateChanged(window(), m_windowState);
421 }
422}
423
425{
426 if (windowFlags().testFlag(Qt::WindowDoesNotAcceptFocus))
427 return;
428
429 auto *view = ownedViewOrNull();
430 if (view != nullptr)
432}
433
434void QOhosPlatformWindow::setWindowMarginsFromOhos(const QMargins &margins)
435{
436 bool marginsChanged = !m_optFrameMargins || *m_optFrameMargins != margins;
437 if (!marginsChanged)
438 return;
439
440 if (m_optFrameMargins) {
441 *m_optFrameMargins = margins;
442 } else {
443 m_optFrameMargins = std::make_unique<QMargins>(margins);
444 }
445
446 qCDebug(QtForOhos) << "Window margins changed: " << *m_optFrameMargins;
447}
448
450{
451 m_exposed = exposed;
452 sendExposeUpdate();
453}
454
456{
457 auto *qWindow = window();
458 auto *view = ownedViewOrNull();
459 bool needsGeometryUpdate =
460 view != nullptr
461 && view->viewType() == QOhosView::ViewType::EmbeddedWindow
462 && window()->isVisible();
463 if (needsGeometryUpdate) {
464 auto scaledGeometry = window()->geometry();
465 qWindow->setGeometry(scaledGeometry);
467 }
468
469 qWindow->requestUpdate();
470 setWindowGeometryFromOhos(windowGeometry());
471}
472
473std::shared_ptr<void> QOhosPlatformWindow::setSurfaceConsumer(
474 QWindow *targetWindow, QObject *surfaceConsumerContext,
475 std::function<void(std::optional<void *>)> surfaceConsumer)
476{
477 qCDebug(
478 QtForOhos,
479 "%s: %s",
480 Q_FUNC_INFO,
481 surfaceConsumerContext->metaObject()->className());
482
483 auto *view = getWindowsViewOrNull(targetWindow);
484 if (view == nullptr)
485 return nullptr;
486
487 if (surfaceConsumerContext->thread() != view->thread() || view->thread() != QThread::currentThread()) {
488 qOhosReportFatalErrorAndAbort(
489 "%s: inter-thread surface consumer connection is not supported", Q_FUNC_INFO);
490 }
491
492 auto sharedSurfaceConsumer = QtOhos::moveToSharedPtr(std::move(surfaceConsumer));
493
494 auto *surface = view->surfaceOrNull();
495 if (surface != nullptr) {
496 QMetaObject::invokeMethod(
497 surfaceConsumerContext,
498 [weakSurfaceConsumer = std::weak_ptr<decltype(surfaceConsumer)>(sharedSurfaceConsumer),
499 targetWindow = QPointer<QWindow>(targetWindow)]() {
500 auto sharedSurfaceConsumer = weakSurfaceConsumer.lock();
501 if (!sharedSurfaceConsumer || targetWindow == nullptr)
502 return;
503
504 auto *view = getWindowsViewOrNull(targetWindow);
505 if (view == nullptr)
506 return;
507
508 auto *surface = view->surfaceOrNull();
509 (*sharedSurfaceConsumer)(
510 surface != nullptr
511 ? std::optional<void *>(surface->nativeWindow())
512 : std::nullopt);
513 },
514 Qt::QueuedConnection);
515 }
516
517 auto surfaceStatusChangedConnectionHandle = QObject::connect(
518 view, &QOhosView::surfaceStatusChanged, surfaceConsumerContext,
519 [view = QPointer<QOhosView>(view), sharedSurfaceConsumer](const std::optional<QSize> &) {
520 if (view == nullptr)
521 return;
522 auto *surface = view->surfaceOrNull();
523 (*sharedSurfaceConsumer)(
524 surface != nullptr
525 ? std::optional<void *>(surface->nativeWindow())
526 : std::nullopt);
527 });
528
529 if (!surfaceStatusChangedConnectionHandle) {
530 qCCritical(
531 QtForOhos,
532 "%s: Connection between ohos view and surface consumer context failed",
533 Q_FUNC_INFO);
534 return nullptr;
535 }
536
537 auto viewDestroyedConnectionHandle = QObject::connect(
538 view, &QObject::destroyed, surfaceConsumerContext,
539 [sharedSurfaceConsumer]() {
540 (*sharedSurfaceConsumer)({});
541 },
542 Qt::QueuedConnection);
543
544 if (!viewDestroyedConnectionHandle) {
545 qCCritical(
546 QtForOhos,
547 "%s: Connecting view destroyed signal to surface consumer context failed",
548 Q_FUNC_INFO);
549 return nullptr;
550 }
551
552 return QtOhos::makeDestroyNotifier(
553 [surfaceStatusChangedConnectionHandle = std::move(surfaceStatusChangedConnectionHandle),
554 viewDestroyedConnectionHandle = std::move(viewDestroyedConnectionHandle)] () mutable {
555 QObject::disconnect(surfaceStatusChangedConnectionHandle);
556 QObject::disconnect(viewDestroyedConnectionHandle);
557 });
558}
559
561{
562 return m_propertiesStore.tryGetProperty<bool, &floatWindowTagProperty>().value_or(false);
563}
564
566{
567 return ownedViewOrNull() != nullptr ? ownedViewOrNull()->makeSnapshot() : QPixmap();
568}
569
570void QOhosPlatformWindow::setDisplayIdFromOhos(std::optional<QOhosDisplayInfo::JsDisplayId> displayId)
571{
572 if (m_displayId != displayId) {
573 m_displayId = displayId;
574
575 qCDebug(QtForOhos)
576 << "Screen changed - window:" << window()
577 << "displayId:" << (displayId.has_value()
578 ? QString::number(displayId.value().value())
579 : QString::fromUtf8("<NO DISPLAY>"));
580
581 QOhosPlatformScreen *screen = m_displayId.has_value()
582 ? QOhosPlatformIntegration::instance()
583 ->screenManager()->platformScreenForDisplayIdOrNull(m_displayId.value())
584 : nullptr;
585
586 QWindowSystemInterface::handleWindowScreenChanged(
587 window(),
588 screen != nullptr
589 ? screen->screen()
590 : nullptr);
591 }
592}
593
594void QOhosPlatformWindow::setWindowGeometryFromOhos(const QRect &nativeWindowDrawGeometry)
595{
596 qCDebug(QtForOhos) << "window:" << window() << "geometry change to:" << nativeWindowDrawGeometry;
597 QWindowSystemInterface::handleGeometryChange(window(), nativeWindowDrawGeometry);
598
599 if (isExposed())
600 sendExposeUpdate();
601}
602
608
610{
611 if (active) {
612 auto *ohosInputContext = qobject_cast<QOhosInputContext *>(QOhosPlatformIntegration::instance()->inputContext());
613 if (ohosInputContext != nullptr) {
614 ohosInputContext->setLastInputTypeToTriggerSoftKeyboard(QOhosInputContext::RequestKeyboardReason::NONE);
615 }
616 } else {
617 if (QOhosPlatformIntegration::instance()->inputContext()->isInputPanelVisible())
618 QOhosPlatformIntegration::instance()->inputContext()->hideInputPanel();
619 }
620}
621
625
629
631{
632 return QOhosPropertiesProvider(m_propertiesStore);
633}
634
636{
637 qCDebug(QtForOhos) << Q_FUNC_INFO << "window:" << window() << "grab:" << grab;
638
640 if (grab)
641 inputHandler->grabMouse(window());
642 else
643 inputHandler->stopAnyMouseGrab();
644
645 return true;
646}
647
649{
650 qCDebug(QtForOhos) << Q_FUNC_INFO << "window:" << window() << "grab:" << grab;
651
653 if (grab)
654 inputHandler->grabKeyboard(window());
655 else
656 inputHandler->stopAnyKeyboardGrab();
657
658 return true;
659}
660
662{
663 auto platformWindowFlags = QOhosPlatformWindow::platformWindowFlagsForQWindow(window());
664 return !platformWindowFlags.testFlag(Qt::WindowDoesNotAcceptFocus);
665}
666
668{
669 auto platformWindowFlags = QOhosPlatformWindow::platformWindowFlagsForQWindow(window());
670 return !platformWindowFlags.testFlag(Qt::WindowTransparentForInput);
671}
672
674{
675 switch (event->type()) {
676 case QEvent::ApplicationPaletteChange:
677 if (auto *ohosView = ownedViewOrNull())
679 break;
680 case QEvent::DynamicPropertyChange: {
681 auto propertyName = static_cast<QDynamicPropertyChangeEvent *>(event)->propertyName();
682 m_propertiesStore.notifyPropertyWrite(propertyName);
683 break;
684 }
685 default: break;
686 }
687
688 return QPlatformWindow::windowEvent(event);
689}
690
691bool QOhosPlatformWindow::isWindowBeingClosedOrDestroyed(QWindow *window)
692{
693 QWindowPrivate *windowPriv = qt_window_private(window);
694 return windowPriv && (windowPriv->inClose || windowPriv->visibilityOnDestroy);
695}
696
697void QOhosPlatformWindow::sendExposeUpdate()
698{
699 auto exposedSize = m_exposed
700 ? geometry().size()
701 : QSize();
702
703 QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), exposedSize)));
704}
705
706QT_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
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.
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