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
381{
382 auto windows = qGuiApp->allWindows();
383 for (auto *window : windows) {
384 if (window->type() == Qt::Popup && window->isVisible())
385 QWindowSystemInterface::handleCloseEvent(window);
386 }
387}
388
390{
391 return nullptr;
392}
393
395{
396 auto *qWindow = window();
397
398 setWindowFlags(qWindow->flags());
399
400 auto initialWindowGeom = windowGeometry();
401 auto initialGeom = initialGeometry(window(), initialWindowGeom, defaultWindowWidth, defaultWindowHeight);
402 QOhosPlatformWindow::setGeometry(initialGeom);
403
404 m_parent = parent();
405}
406
408{
409 return m_windowState;
410}
411
412void QOhosPlatformWindow::setWindowStateFromOhos(Qt::WindowStates state)
413{
414 if (m_lastWindowState != state) {
415 m_windowState = state;
416 m_lastWindowState = state;
417 QWindowSystemInterface::handleWindowStateChanged(window(), m_windowState);
418 }
419}
420
422{
423 if (windowFlags().testFlag(Qt::WindowDoesNotAcceptFocus))
424 return;
425
426 auto *view = ownedViewOrNull();
427 if (view != nullptr)
429}
430
431void QOhosPlatformWindow::setWindowMarginsFromOhos(const QMargins &margins)
432{
433 bool marginsChanged = !m_optFrameMargins || *m_optFrameMargins != margins;
434 if (!marginsChanged)
435 return;
436
437 if (m_optFrameMargins) {
438 *m_optFrameMargins = margins;
439 } else {
440 m_optFrameMargins = std::make_unique<QMargins>(margins);
441 }
442
443 qCDebug(QtForOhos) << "Window margins changed: " << *m_optFrameMargins;
444}
445
447{
448 m_exposed = exposed;
449 sendExposeUpdate();
450}
451
453{
454 auto *qWindow = window();
455 auto *view = ownedViewOrNull();
456 bool needsGeometryUpdate =
457 view != nullptr
458 && view->viewType() == QOhosView::ViewType::EmbeddedWindow
459 && window()->isVisible();
460 if (needsGeometryUpdate) {
461 auto scaledGeometry = window()->geometry();
462 qWindow->setGeometry(scaledGeometry);
464 }
465
466 qWindow->requestUpdate();
467 setWindowGeometryFromOhos(windowGeometry());
468}
469
470std::shared_ptr<void> QOhosPlatformWindow::setSurfaceConsumer(
471 QWindow *targetWindow, QObject *surfaceConsumerContext,
472 std::function<void(std::optional<void *>)> surfaceConsumer)
473{
474 qCDebug(
475 QtForOhos,
476 "%s: %s",
477 Q_FUNC_INFO,
478 surfaceConsumerContext->metaObject()->className());
479
480 auto *view = getWindowsViewOrNull(targetWindow);
481 if (view == nullptr)
482 return nullptr;
483
484 if (surfaceConsumerContext->thread() != view->thread() || view->thread() != QThread::currentThread()) {
485 qOhosReportFatalErrorAndAbort(
486 "%s: inter-thread surface consumer connection is not supported", Q_FUNC_INFO);
487 }
488
489 auto sharedSurfaceConsumer = QtOhos::moveToSharedPtr(std::move(surfaceConsumer));
490
491 auto *surface = view->surfaceOrNull();
492 if (surface != nullptr) {
493 QMetaObject::invokeMethod(
494 surfaceConsumerContext,
495 [weakSurfaceConsumer = std::weak_ptr<decltype(surfaceConsumer)>(sharedSurfaceConsumer),
496 targetWindow = QPointer<QWindow>(targetWindow)]() {
497 auto sharedSurfaceConsumer = weakSurfaceConsumer.lock();
498 if (!sharedSurfaceConsumer || targetWindow == nullptr)
499 return;
500
501 auto *view = getWindowsViewOrNull(targetWindow);
502 if (view == nullptr)
503 return;
504
505 auto *surface = view->surfaceOrNull();
506 (*sharedSurfaceConsumer)(
507 surface != nullptr
508 ? std::optional<void *>(surface->nativeWindow())
509 : std::nullopt);
510 },
511 Qt::QueuedConnection);
512 }
513
514 auto surfaceStatusChangedConnectionHandle = QObject::connect(
515 view, &QOhosView::surfaceStatusChanged, surfaceConsumerContext,
516 [view = QPointer<QOhosView>(view), sharedSurfaceConsumer](const std::optional<QSize> &) {
517 if (view == nullptr)
518 return;
519 auto *surface = view->surfaceOrNull();
520 (*sharedSurfaceConsumer)(
521 surface != nullptr
522 ? std::optional<void *>(surface->nativeWindow())
523 : std::nullopt);
524 });
525
526 if (!surfaceStatusChangedConnectionHandle) {
527 qCCritical(
528 QtForOhos,
529 "%s: Connection between ohos view and surface consumer context failed",
530 Q_FUNC_INFO);
531 return nullptr;
532 }
533
534 auto viewDestroyedConnectionHandle = QObject::connect(
535 view, &QObject::destroyed, surfaceConsumerContext,
536 [sharedSurfaceConsumer]() {
537 (*sharedSurfaceConsumer)({});
538 },
539 Qt::QueuedConnection);
540
541 if (!viewDestroyedConnectionHandle) {
542 qCCritical(
543 QtForOhos,
544 "%s: Connecting view destroyed signal to surface consumer context failed",
545 Q_FUNC_INFO);
546 return nullptr;
547 }
548
549 return QtOhos::makeDestroyNotifier(
550 [surfaceStatusChangedConnectionHandle = std::move(surfaceStatusChangedConnectionHandle),
551 viewDestroyedConnectionHandle = std::move(viewDestroyedConnectionHandle)] () mutable {
552 QObject::disconnect(surfaceStatusChangedConnectionHandle);
553 QObject::disconnect(viewDestroyedConnectionHandle);
554 });
555}
556
558{
559 return m_propertiesStore.tryGetProperty<bool, &floatWindowTagProperty>().value_or(false);
560}
561
563{
564 return ownedViewOrNull() != nullptr ? ownedViewOrNull()->makeSnapshot() : QPixmap();
565}
566
567void QOhosPlatformWindow::setDisplayIdFromOhos(std::optional<QOhosDisplayInfo::JsDisplayId> displayId)
568{
569 if (m_displayId != displayId) {
570 m_displayId = displayId;
571
572 qCDebug(QtForOhos)
573 << "Screen changed - window:" << window()
574 << "displayId:" << (displayId.has_value()
575 ? QString::number(displayId.value().value())
576 : QString::fromUtf8("<NO DISPLAY>"));
577
578 QOhosPlatformScreen *screen = m_displayId.has_value()
579 ? QOhosPlatformIntegration::instance()
580 ->screenManager()->platformScreenForDisplayIdOrNull(m_displayId.value())
581 : nullptr;
582
583 QWindowSystemInterface::handleWindowScreenChanged(
584 window(),
585 screen != nullptr
586 ? screen->screen()
587 : nullptr);
588 }
589}
590
591void QOhosPlatformWindow::setWindowGeometryFromOhos(const QRect &nativeWindowDrawGeometry)
592{
593 qCDebug(QtForOhos) << "window:" << window() << "geometry change to:" << nativeWindowDrawGeometry;
594 QWindowSystemInterface::handleGeometryChange(window(), nativeWindowDrawGeometry);
595
596 if (isExposed())
597 sendExposeUpdate();
598}
599
605
607{
608 if (active) {
609 auto *ohosInputContext = qobject_cast<QOhosInputContext *>(QOhosPlatformIntegration::instance()->inputContext());
610 if (ohosInputContext != nullptr) {
611 ohosInputContext->setLastInputTypeToTriggerSoftKeyboard(QOhosInputContext::RequestKeyboardReason::NONE);
612 }
613 } else {
614 if (QOhosPlatformIntegration::instance()->inputContext()->isInputPanelVisible())
615 QOhosPlatformIntegration::instance()->inputContext()->hideInputPanel();
616 }
617}
618
622
626
628{
629 return QOhosPropertiesProvider(m_propertiesStore);
630}
631
633{
634 qCDebug(QtForOhos) << Q_FUNC_INFO << "window:" << window() << "grab:" << grab;
635
637 if (grab)
638 inputHandler->grabMouse(window());
639 else
640 inputHandler->stopAnyMouseGrab();
641
642 return true;
643}
644
646{
647 qCDebug(QtForOhos) << Q_FUNC_INFO << "window:" << window() << "grab:" << grab;
648
650 if (grab)
651 inputHandler->grabKeyboard(window());
652 else
653 inputHandler->stopAnyKeyboardGrab();
654
655 return true;
656}
657
659{
660 auto platformWindowFlags = QOhosPlatformWindow::platformWindowFlagsForQWindow(window());
661 return !platformWindowFlags.testFlag(Qt::WindowDoesNotAcceptFocus);
662}
663
665{
666 auto platformWindowFlags = QOhosPlatformWindow::platformWindowFlagsForQWindow(window());
667 return !platformWindowFlags.testFlag(Qt::WindowTransparentForInput);
668}
669
671{
672 switch (event->type()) {
673 case QEvent::ApplicationPaletteChange:
674 if (auto *ohosView = ownedViewOrNull())
676 break;
677 case QEvent::DynamicPropertyChange: {
678 auto propertyName = static_cast<QDynamicPropertyChangeEvent *>(event)->propertyName();
679 m_propertiesStore.notifyPropertyWrite(propertyName);
680 break;
681 }
682 default: break;
683 }
684
685 return QPlatformWindow::windowEvent(event);
686}
687
688bool QOhosPlatformWindow::isWindowBeingClosedOrDestroyed(QWindow *window)
689{
690 QWindowPrivate *windowPriv = qt_window_private(window);
691 return windowPriv && (windowPriv->inClose || windowPriv->visibilityOnDestroy);
692}
693
694void QOhosPlatformWindow::sendExposeUpdate()
695{
696 auto exposedSize = m_exposed
697 ? geometry().size()
698 : QSize();
699
700 QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), exposedSize)));
701}
702
703QT_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