本文整理汇总了C++中QPlatformNativeInterface类的典型用法代码示例。如果您正苦于以下问题:C++ QPlatformNativeInterface类的具体用法?C++ QPlatformNativeInterface怎么用?C++ QPlatformNativeInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QPlatformNativeInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
void GVRInterface::enterVRMode() {
#if defined(ANDROID) && defined(HAVE_LIBOVR)
// Default vrModeParms
ovrModeParms vrModeParms;
vrModeParms.AsynchronousTimeWarp = true;
vrModeParms.AllowPowerSave = true;
vrModeParms.DistortionFileName = NULL;
vrModeParms.EnableImageServer = false;
vrModeParms.CpuLevel = 2;
vrModeParms.GpuLevel = 2;
vrModeParms.GameThreadTid = 0;
QAndroidJniEnvironment jniEnv;
QPlatformNativeInterface* interface = QApplication::platformNativeInterface();
jobject activity = (jobject) interface->nativeResourceForIntegration("QtActivity");
vrModeParms.ActivityObject = activity;
ovrHmdInfo hmdInfo;
_ovr = ovr_EnterVrMode(vrModeParms, &hmdInfo);
_inVRMode = true;
#endif
}
示例2: qDebug
void XCompositeGLXClientBufferIntegration::initializeHardware(QtWayland::Display *)
{
qDebug() << "Initializing GLX integration";
QPlatformNativeInterface *nativeInterface = QGuiApplicationPrivate::platformIntegration()->nativeInterface();
if (nativeInterface) {
mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForWindow("Display",m_compositor->window()));
if (!mDisplay)
qFatal("could not retireve Display from platform integration");
} else {
qFatal("Platform integration doesn't have native interface");
}
mScreen = XDefaultScreen(mDisplay);
mHandler = new XCompositeHandler(m_compositor->handle(), mDisplay);
QOpenGLContext *glContext = new QOpenGLContext();
glContext->create();
m_glxBindTexImageEXT = reinterpret_cast<PFNGLXBINDTEXIMAGEEXTPROC>(glContext->getProcAddress("glXBindTexImageEXT"));
if (!m_glxBindTexImageEXT) {
qDebug() << "Did not find glxBindTexImageExt, everything will FAIL!";
}
m_glxReleaseTexImageEXT = reinterpret_cast<PFNGLXRELEASETEXIMAGEEXTPROC>(glContext->getProcAddress("glXReleaseTexImageEXT"));
if (!m_glxReleaseTexImageEXT) {
qDebug() << "Did not find glxReleaseTexImageExt";
}
delete glContext;
}
示例3: last_is_alarm
VibroWorker::VibroWorker ()
: last_is_alarm (false), last_vibration_looped (false),
mCancel (NULL), mVibrate (NULL), mVibratePattern (NULL),
objVibrator (NULL)
{
QPlatformNativeInterface *interface = QApplication::platformNativeInterface ();
jobject objActivity = (jobject) interface->nativeResourceForIntegration ("QtActivity");
jclass classActivity = jni_env->FindClass ("android/app/Activity");
if (objActivity && classActivity) {
jmethodID mSystemService = jni_env->GetMethodID (classActivity, "getSystemService", "(Ljava/lang/String;)Ljava/lang/Object;");
jstring strMethod = jni_env->NewStringUTF ("vibrator");
if (mSystemService && strMethod)
objVibrator = jni_env->CallObjectMethod (objActivity, mSystemService, strMethod);
if (objVibrator) {
jclass classVibrator = jni_env->GetObjectClass (objVibrator);
if (classVibrator) {
mCancel = jni_env->GetMethodID (classVibrator, "cancel", "()V");
mVibrate = jni_env->GetMethodID (classVibrator, "vibrate", "(J)V");
mVibratePattern = jni_env->GetMethodID (classVibrator, "vibrate", "([JI)V");
}
}
}
cancel_vibration_timer.setSingleShot (true);
connect (&cancel_vibration_timer, SIGNAL (timeout ()), this, SLOT (cancelLoopedVibration ()));
}
示例4:
static JavaVM *getJavaVM()
{
if (!g_javaVM){
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
g_javaVM = static_cast<JavaVM*>(nativeInterface->nativeResourceForIntegration("JavaVM"));
}
return g_javaVM;
}
示例5: enableMacToolBar
static void enableMacToolBar(QToolBar *toolbar, bool enable)
{
QPlatformNativeInterface *nativeInterface = QApplication::platformNativeInterface();
QPlatformNativeInterface::NativeResourceForIntegrationFunction function =
nativeInterface->nativeResourceFunctionForIntegration("setContentBorderAreaEnabled");
if (!function)
return; // Not Cocoa platform plugin.
typedef void (*SetContentBorderAreaEnabledFunction)(QWindow *window, void *identifier, bool enabled);
(reinterpret_cast<SetContentBorderAreaEnabledFunction>(function))(toolbar->window()->windowHandle(), toolbar, enable);
}
示例6: Q_Q
void InputRegionPrivate::update()
{
Q_Q(InputRegion);
q->killTimer(updateTimerId);
updateTimerId = 0;
if (window && window->handle()) {
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
native->setWindowProperty(window->handle(), QLatin1String("MOUSE_REGION"), QVariant(QRegion(x, y, width, height)));
}
}
示例7: x11Display
inline static Display* x11Display() {
// Qt 5 does not support QX11Info.
#if QT_VERSION >= 0x050000
// references: https://github.com/hawaii-desktop/libkdeqt5staging/blob/master/src/qt5only/qx11info.cpp
QPlatformNativeInterface* native = qApp->platformNativeInterface();
void* display = native->nativeResourceForScreen(QByteArray("display"), QGuiApplication::primaryScreen());
return reinterpret_cast<Display*>(display);
#else
return QX11Info::display();
#endif
}
示例8: get_egl_display
/*------------------------------------------------------------------------------
| get_egl_display
+-----------------------------------------------------------------------------*/
EGLDisplay get_egl_display()
{
QPlatformNativeInterface* nativeInterface =
QGuiApplicationPrivate::platformIntegration()->nativeInterface();
Q_ASSERT(nativeInterface);
EGLDisplay d = nativeInterface->nativeResourceForIntegration("egldisplay");
if (!d)
log_warn("Couldn't get EGL display handle.");
return d;
}
示例9: makeObject
void GLWidget::makeObject()
{
static const int coords[6][4][3] = {
{ { +1, -1, -1 }, { -1, -1, -1 }, { -1, +1, -1 }, { +1, +1, -1 } },
{ { +1, +1, -1 }, { -1, +1, -1 }, { -1, +1, +1 }, { +1, +1, +1 } },
{ { +1, -1, +1 }, { +1, -1, -1 }, { +1, +1, -1 }, { +1, +1, +1 } },
{ { -1, -1, -1 }, { -1, -1, +1 }, { -1, +1, +1 }, { -1, +1, -1 } },
{ { +1, -1, +1 }, { -1, -1, +1 }, { -1, -1, -1 }, { +1, -1, -1 } },
{ { -1, -1, +1 }, { +1, -1, +1 }, { +1, +1, +1 }, { -1, +1, +1 } }
};
QElapsedTimer timer;
timer.start();
#ifndef DISABLED_OPENMAX
//loadWithOmx();
QPlatformNativeInterface* nativeInterface = QGuiApplicationPrivate::platformIntegration()->nativeInterface();
Q_ASSERT(nativeInterface);
EGLDisplay eglDisplay = nativeInterface->nativeResourceForIntegration("egldisplay");
EGLContext eglContext = nativeInterface->nativeResourceForContext("eglcontext", QOpenGLContext::currentContext());
#if 0
eglImageVideo = getEGLImage(1920, 1080, eglDisplay, eglContext, textures[0]);
#endif
for (int i = 0; i < 5; i++)
textures[i] = 0;
//QtConcurrent::run(video_decode_test, videoPath, eglImageVideo, eglDisplay);
m_videoProc = new OMX_VideoProcessor(eglDisplay, eglContext, m_provider);
connect(m_videoProc, SIGNAL(textureReady(uint)), this, SLOT(onTextureChanged(uint)));
m_videoProc->setVideoPath("/home/pi/out.h264");
m_videoProc->play();
#else
for (int i = 0; i < 6; i++) {
QPixmap pixmap(QString("%1%2.jpg").arg(prefix).arg(i));
if (pixmap.isNull())
LOG_ERROR(LOG_TAG, "Failed to load image!");
textures[i] = bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA);
}
#endif
LOG_INFORMATION(LOG_TAG, "Elapsed: %lld.", timer.elapsed());
for (int i = 0; i < 6; ++i) {
for (int j = 0; j < 4; ++j) {
texCoords.append
(QVector2D(j == 0 || j == 3, j == 0 || j == 1));
vertices.append
(QVector3D(0.2 * coords[i][j][0], 0.2 * coords[i][j][1],
0.2 * coords[i][j][2]));
}
}
}
示例10: instantiateTexture
OMX_TextureData* OMX_TextureProviderQGLWidget::instantiateTexture(QSize size)
{
// TODO: Reimplement.
#if 0
m_parent->makeCurrent();
QPlatformNativeInterface* nativeInterface = QGuiApplicationPrivate::platformIntegration()->nativeInterface();
Q_ASSERT(nativeInterface);
EGLDisplay eglDisplay = nativeInterface->nativeResourceForIntegration("egldisplay");
EGLContext eglContext = nativeInterface->nativeResourceForContext("eglcontext", QOpenGLContext::currentContext());
GLuint texture;
eglImageVideo = getEGLImage(size.width(), size.height(), eglDisplay, eglContext, texture);
return texture;
#endif
return 0;
}
示例11: dbg
QHimePlatformInputContext::QHimePlatformInputContext()
{
dbg("QHimePlatformInputContext::QHimePlatformInputContext() \n");
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
if(!native)
return;
Display *display = static_cast<Display *>(native->nativeResourceForWindow("display", NULL));
if (!(hime_ch = hime_im_client_open(display))) {
perror("cannot open hime_ch");
dbg("hime_im_client_open error\n");
return;
}
dbg("QHimePlatformInputContext succ\n");
}
示例12: initializeHardware
void XCompositeEglClientBufferIntegration::initializeHardware(QtWayland::Display *)
{
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
if (nativeInterface) {
mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForIntegration("Display"));
if (!mDisplay)
qFatal("could not retrieve Display from platform integration");
mEglDisplay = static_cast<EGLDisplay>(nativeInterface->nativeResourceForIntegration("EGLDisplay"));
if (!mEglDisplay)
qFatal("could not retrieve EGLDisplay from platform integration");
} else {
qFatal("Platform integration doesn't have native interface");
}
mScreen = XDefaultScreen(mDisplay);
new XCompositeHandler(m_compositor->handle(), mDisplay);
}
示例13: get_global_egl_context
/*------------------------------------------------------------------------------
| get_egl_context
+-----------------------------------------------------------------------------*/
EGLContext get_global_egl_context()
{
QOpenGLContext* c = QOpenGLContext::globalShareContext();
if (!c)
return (void*)log_warn("Cannot get an OpenGL context.");
QPlatformNativeInterface* nativeInterface =
QGuiApplicationPrivate::platformIntegration()->nativeInterface();
Q_ASSERT(nativeInterface);
EGLContext eglc =
nativeInterface->nativeResourceForContext("eglcontext", c);
if (!eglc)
log_warn("Couldn't get EGL context from currrent OpenGL context.");
return eglc;
}
示例14: Compositor
Compositor *Compositor::fromApplication(QObject *parent)
{
if (!QGuiApplication::platformName().contains(QStringLiteral("wayland"), Qt::CaseInsensitive)) {
return nullptr;
}
QPlatformNativeInterface *native = qApp->platformNativeInterface();
if (!native) {
return nullptr;
}
wl_compositor *compositor = reinterpret_cast<wl_compositor*>(native->nativeResourceForIntegration(QByteArrayLiteral("compositor")));
if (!compositor) {
return nullptr;
}
Compositor *c = new Compositor(parent);
c->d->compositor.setup(compositor, true);
return c;
}
示例15: accessibleInterface
/**************************************************************\
* IOleWindow *
**************************************************************/
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::GetWindow(HWND *phwnd)
{
*phwnd = 0;
QAccessibleInterface *accessible = accessibleInterface();
accessibleDebugClientCalls(accessible);
if (!accessible)
return E_FAIL;
QWindow *window = QWindowsAccessibility::windowHelper(accessible);
if (!window)
return E_FAIL;
QPlatformNativeInterface *platform = QGuiApplication::platformNativeInterface();
Q_ASSERT(platform);
*phwnd = (HWND)platform->nativeResourceForWindow("handle", window);
accessibleDebug("QWindowsAccessible::GetWindow(): %p", *phwnd);
return S_OK;
}