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
qohosplatformnativeinterface.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
8#include <qohosjsenv_p.h>
9
10#if QT_CONFIG(vulkan)
11#include "render/qohossurface.h"
12#include <QtGui/qvulkaninstance.h>
13#endif
14
15#include <QtCore/qmutex.h>
16#include <QtGui/private/qguiapplication_p.h>
17
19
20void *QOhosPlatformNativeInterface::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
21{
22#if QT_CONFIG(vulkan)
23 if (resource == "vkSurface") {
24 if (window && window->surfaceType() == QSurface::VulkanSurface) {
25 auto *platformWindow = static_cast<QOhosPlatformWindow *>(window->handle());
26 QOhosSurface *surface = platformWindow ? platformWindow->ownedSurfaceOrNull() : nullptr;
27 if (!surface) {
28 qWarning("QOhosPlatformNativeInterface: No QOhosSurface available for Vulkan window");
29 return nullptr;
30 }
31 QVulkanInstance *vulkanInstance = window->vulkanInstance();
32 if (!vulkanInstance) {
33 qWarning("QOhosPlatformNativeInterface: No Vulkan instance; was QWindow::setVulkanInstance() called?");
34 return nullptr;
35 }
36 return surface->tryGetOrCreateVulkanWindowSurface(vulkanInstance);
37 }
38 }
39#else
40 Q_UNUSED(resource);
41 Q_UNUSED(window);
42#endif
43 return nullptr;
44}
45
47{
48 auto __dbg = make_QCScopedDebug("QOhosPlatformNativeInterface::customEvent");
49 if (event->type() != QEvent::User)
50 return;
51}
52
54{
55 if (functionName == "tagWindowOrWidgetAsSubWindowOf") {
56 return reinterpret_cast<QFunctionPointer>(&QOhosPlatformWindow::tagWindowOrWidgetAsSubWindowOf);
57 } else if (functionName == "getWindowOrWidgetAsSubWindowOfTagValue") {
58 return reinterpret_cast<QFunctionPointer>(&QOhosPlatformWindow::getWindowOrWidgetAsSubWindowOfTagValue);
59 } else if (functionName == "tagWindowOrWidgetAsMainWindow") {
60 return reinterpret_cast<QFunctionPointer>(&QOhosPlatformWindow::tagWindowOrWidgetAsMainWindow);
61 } else if (functionName == "setInAppOnlyPasteboardShareOption") {
62 return reinterpret_cast<QFunctionPointer>(
64 } else if (functionName == "setSurfaceConsumer") {
65 return reinterpret_cast<QFunctionPointer>(&QOhosPlatformWindow::setSurfaceConsumer);
66 }
67
68 return QPlatformNativeInterface::platformFunction(functionName);
69}
70
71QT_END_NAMESPACE
static void setInAppOnlyPasteboardShareOption(bool shareInAppOnly)
QFunctionPointer platformFunction(const QByteArray &functionName) const override
void * nativeResourceForWindow(const QByteArray &resource, QWindow *window) override
void customEvent(QEvent *event) override
This event handler can be reimplemented in a subclass to receive custom events.
Combined button and popup list for selecting options.