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
qqnxnativeinterface.cpp
Go to the documentation of this file.
1// Copyright (C) 2012 Research In Motion
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
6
7#if !defined(QT_NO_OPENGL)
9#endif
10
11#if QT_CONFIG(vulkan)
12#include "qqnxvulkanwindow.h"
13#endif
14
15#include "qqnxscreen.h"
16#include "qqnxwindow.h"
17#if defined(QQNX_IMF)
18#include "qqnxinputcontext_imf.h"
19#endif
20
22
23#if !defined(QT_NO_OPENGL)
24#include <QtGui/QOpenGLContext>
25#endif
26
27#include <QtGui/QScreen>
28#include <QtGui/QWindow>
29
31
32using namespace Qt::StringLiterals;
33
35 : m_integration(integration)
36{
37}
38
39void *QQnxNativeInterface::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
40{
41#if QT_CONFIG(vulkan)
42 if (resource == "vkSurface") {
43 if (window && window->surfaceType() == QSurface::VulkanSurface && window->handle())
44 return static_cast<QQnxVulkanWindow *>(window->handle())->surface();
45 return nullptr;
46 }
47#endif
48
49 if (resource == "windowGroup" && window && window->screen()) {
50 QQnxScreen * const screen = static_cast<QQnxScreen *>(window->screen()->handle());
51 if (screen) {
52 screen_window_t screenWindow = reinterpret_cast<screen_window_t>(window->winId());
53 QQnxWindow *qnxWindow = screen->findWindow(screenWindow);
54 // We can't just call data() instead of constData() here, since that would detach
55 // and the lifetime of the char * would not be long enough. Therefore the const_cast.
56 return qnxWindow ? const_cast<char *>(qnxWindow->groupName().constData()) : 0;
57 }
58 }
59
60 return 0;
61}
62
63void *QQnxNativeInterface::nativeResourceForScreen(const QByteArray &resource, QScreen *screen)
64{
65 if (resource == "QObject*" && screen)
66 return static_cast<QObject*>(static_cast<QQnxScreen*>(screen->handle()));
67
68 return 0;
69}
70
71void *QQnxNativeInterface::nativeResourceForIntegration(const QByteArray &resource)
72{
73 if (resource == "screenContext")
74 return m_integration->screenContext();
75
76#if QT_CONFIG(opengl)
77 if (resource.toLower() == "egldisplay")
78 return m_integration->eglDisplay();
79#endif
80
81 return 0;
82}
83
84#if !defined(QT_NO_OPENGL)
85void *QQnxNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context)
86{
87 if (resource == "eglcontext" && context)
88 return static_cast<QQnxGLContext*>(context->handle())->eglContext();
89
90 return 0;
91}
92#endif
93
94void QQnxNativeInterface::setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value)
95{
96 QQnxWindow *qnxWindow = static_cast<QQnxWindow*>(window);
97
98 if (name == "qnxWindowGroup"_L1) {
99 if (value.isNull())
100 qnxWindow->joinWindowGroup(QByteArray());
101 else if (value.canConvert<QByteArray>())
102 qnxWindow->joinWindowGroup(value.toByteArray());
103 }
104}
105
107{
108#if defined(QQNX_IMF)
109 if (resource == "blackberryIMFSetHighlightColor")
110 return reinterpret_cast<NativeResourceForIntegrationFunction>(QQnxInputContext::setHighlightColor);
111 if (resource == "blackberryIMFCheckSpelling")
112 return reinterpret_cast<NativeResourceForIntegrationFunction>(QQnxInputContext::checkSpelling);
113#else
114 Q_UNUSED(resource);
115#endif
116 return 0;
117}
118
119QT_END_NAMESPACE
void * nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override
void * nativeResourceForWindow(const QByteArray &resource, QWindow *window) override
void * nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override
QQnxNativeInterface(QQnxIntegration *integration)
void * nativeResourceForIntegration(const QByteArray &resource) override
NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) override
void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value) override
Sets a window property with name to value.
The QQnxWindow is the base class of the various classes used as instances of QPlatformWindow in the Q...
Definition qqnxwindow.h:32
Combined button and popup list for selecting options.