当前位置: 首页>>代码示例>>C++>>正文


C++ QPlatformNativeInterface类代码示例

本文整理汇总了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
}
开发者ID:Nex-Pro,项目名称:hifi,代码行数:25,代码来源:GVRInterface.cpp

示例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;
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:29,代码来源:xcompositeglxintegration.cpp

示例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 ()));
}
开发者ID:BrandyMint,项目名称:KitchenTimer,代码行数:31,代码来源:vibrosequencer.cpp

示例4:

static JavaVM *getJavaVM()
{
    if (!g_javaVM){
        QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
        g_javaVM = static_cast<JavaVM*>(nativeInterface->nativeResourceForIntegration("JavaVM"));
    }
    return g_javaVM;
}
开发者ID:FlavioFalcao,项目名称:qt5,代码行数:8,代码来源:qjnihelpers.cpp

示例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);
}
开发者ID:jhribal,项目名称:qtbase,代码行数:11,代码来源:qtoolbar.cpp

示例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)));
    }
}
开发者ID:WhiteSymmetry,项目名称:sailfish-browser,代码行数:11,代码来源:inputregion.cpp

示例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
}
开发者ID:ArthurBorsboom,项目名称:lxinput-qt,代码行数:12,代码来源:maindialog.cpp

示例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;
}
开发者ID:carlonluca,项目名称:pi,代码行数:15,代码来源:omx_globals.cpp

示例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]));
        }
    }
}
开发者ID:bgbadchrs,项目名称:pi,代码行数:50,代码来源:glwidget.cpp

示例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;
}
开发者ID:bgbadchrs,项目名称:pi,代码行数:15,代码来源:glwidget.cpp

示例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");
}
开发者ID:Kirayao,项目名称:hime,代码行数:16,代码来源:hime-imcontext-qt.cpp

示例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);
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:16,代码来源:xcompositeeglintegration.cpp

示例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;
}
开发者ID:carlonluca,项目名称:pi,代码行数:20,代码来源:omx_globals.cpp

示例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;
}
开发者ID:KDE,项目名称:kwayland,代码行数:17,代码来源:compositor.cpp

示例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;
}
开发者ID:CodeDJ,项目名称:qt5-hidpi,代码行数:21,代码来源:qwindowsmsaaaccessible.cpp


注:本文中的QPlatformNativeInterface类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。