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>
18
19void *QOhosPlatformNativeInterface::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
20{
21#if QT_CONFIG(vulkan)
22 if (resource == "vkSurface") {
23 if (window && window->surfaceType() == QSurface::VulkanSurface) {
24 auto *platformWindow = static_cast<QOhosPlatformWindow *>(window->handle());
25 QOhosSurface *surface = platformWindow ? platformWindow->ownedSurfaceOrNull() : nullptr;
26 if (!surface) {
27 qWarning("QOhosPlatformNativeInterface: No QOhosSurface available for Vulkan window");
28 return nullptr;
29 }
30 QVulkanInstance *vulkanInstance = window->vulkanInstance();
31 if (!vulkanInstance) {
32 qWarning("QOhosPlatformNativeInterface: No Vulkan instance; was QWindow::setVulkanInstance() called?");
33 return nullptr;
34 }
35 return surface->tryGetOrCreateVulkanWindowSurface(vulkanInstance);
36 }
37 }
38#else
39 Q_UNUSED(resource);
40 Q_UNUSED(window);
41#endif
42 return nullptr;
43}
44
46{
47 auto __dbg = make_QCScopedDebug("QOhosPlatformNativeInterface::customEvent");
48 if (event->type() != QEvent::User)
49 return;
50}
51
53{
54 if (functionName == "tagWindowOrWidgetAsSubWindowOf") {
55 return reinterpret_cast<QFunctionPointer>(&QOhosPlatformWindow::tagWindowOrWidgetAsSubWindowOf);
56 } else if (functionName == "getWindowOrWidgetAsSubWindowOfTagValue") {
57 return reinterpret_cast<QFunctionPointer>(&QOhosPlatformWindow::getWindowOrWidgetAsSubWindowOfTagValue);
58 } else if (functionName == "tagWindowOrWidgetAsMainWindow") {
59 return reinterpret_cast<QFunctionPointer>(&QOhosPlatformWindow::tagWindowOrWidgetAsMainWindow);
60 } else if (functionName == "setInAppOnlyPasteboardShareOption") {
61 return reinterpret_cast<QFunctionPointer>(
63 } else if (functionName == "setSurfaceConsumer") {
64 return reinterpret_cast<QFunctionPointer>(&QOhosPlatformWindow::setSurfaceConsumer);
65 }
66
67 return QPlatformNativeInterface::platformFunction(functionName);
68}
69
70QT_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.