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


C++ QWidget::grabGesture方法代码示例

本文整理汇总了C++中QWidget::grabGesture方法的典型用法代码示例。如果您正苦于以下问题:C++ QWidget::grabGesture方法的具体用法?C++ QWidget::grabGesture怎么用?C++ QWidget::grabGesture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QWidget的用法示例。


在下文中一共展示了QWidget::grabGesture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: widget

void OpenGL2Common::testGLInternal()
{
	int glMajor = 0, glMinor = 0;
#ifndef OPENGL_ES2
	glGetIntegerv(GL_MAJOR_VERSION, &glMajor);
	glGetIntegerv(GL_MINOR_VERSION, &glMinor);
#endif
	if (!glMajor)
	{
		const QString glVersionStr = (const char *)glGetString(GL_VERSION);
		const int dotIdx = glVersionStr.indexOf('.');
		if (dotIdx > 0)
		{
			const int vIdx = glVersionStr.lastIndexOf(' ', dotIdx);
			if (sscanf(glVersionStr.mid(vIdx < 0 ? 0 : vIdx).toLatin1().data(), "%d.%d", &glMajor, &glMinor) != 2)
				glMajor = glMinor = 0;
		}
	}
	if (glMajor)
		glVer = glMajor * 10 + glMinor;

#ifndef OPENGL_ES2
	initGLProc();
	if (!canCreateNonPowerOfTwoTextures || !supportsShaders || !glActiveTexture)
	{
		showOpenGLMissingFeaturesMessage();
		isOK = false;
	}
	/* Reset variables */
	supportsShaders = canCreateNonPowerOfTwoTextures = false;
	glActiveTexture = NULL;
#endif

	QWidget *w = widget();
	w->grabGesture(Qt::PinchGesture);
	w->setMouseTracking(true);
#ifdef Q_OS_WIN
	/*
	 * This property is read by QMPlay2 and it ensures that toolbar will be visible
	 * on fullscreen in Windows Vista and newer on nVidia and AMD drivers.
	*/
	if (preventFullscreen && QSysInfo::windowsVersion() >= QSysInfo::WV_6_0)
		w->setProperty("PreventFullscreen", true);
#endif
}
开发者ID:mitya57,项目名称:QMPlay2,代码行数:45,代码来源:OpenGL2Common.cpp

示例2: if


//.........这里部分代码省略.........
    if (hwAccellnterface)
    {
        switch (hwAccellnterface->getFormat())
        {
            case HWAccelInterface::NV12:
                numPlanes = 2;
                break;
            case HWAccelInterface::RGB32:
                numPlanes = 1;
                break;
        }

        if (hwAccellnterface->isTextureRectangle())
        {
            target = GL_TEXTURE_RECTANGLE_ARB;
            if (numPlanes == 1)
                isOK = false; // Not used and not supported
            hqScaling = false; // Not yet supported
        }

        if (isOK)
        {
            quint32 textures[numPlanes];
            memset(textures, 0, sizeof textures);
            glGenTextures(numPlanes, textures);
            if (hwAccellnterface->canInitializeTextures())
            {
                for (int p = 0; p < numPlanes; ++p)
                {
                    glBindTexture(target, textures[p]);
                    if (numPlanes == 2)
                        glTexImage2D(target, 0, !p ? GL_R8 : GL_RG8, 1, 1, 0, !p ? GL_RED : GL_RG, GL_UNSIGNED_BYTE, nullptr);
                    else if (numPlanes == 1)
                        glTexImage2D(target, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
                }
            }

            if (!hwAccellnterface->lock())
                isOK = false;
            else
            {
                if (!hwAccellnterface->init(textures))
                    isOK = false;
                if (numPlanes == 1) //For RGB32 format, HWAccel should be able to adjust the video
                {
                    VideoAdjustment videoAdjustmentCap;
                    hwAccellnterface->getVideAdjustmentCap(videoAdjustmentCap);
                    if (videoAdjustmentCap.brightness)
                        videoAdjustmentKeys += "Brightness";
                    if (videoAdjustmentCap.contrast)
                        videoAdjustmentKeys += "Contrast";
                    if (videoAdjustmentCap.saturation)
                        videoAdjustmentKeys += "Saturation";
                    if (videoAdjustmentCap.hue)
                        videoAdjustmentKeys += "Hue";
                    if (videoAdjustmentCap.sharpness)
                        videoAdjustmentKeys += "Sharpness";
                }
                hwAccellnterface->clear(true);
                hwAccellnterface->unlock();
            }

            glDeleteTextures(numPlanes, textures);
        }
    }

    QWidget *w = widget();
    w->grabGesture(Qt::PinchGesture);
    w->setMouseTracking(true);
#ifdef Q_OS_WIN
    /*
     * This property is read by QMPlay2 and it ensures that toolbar will be visible
     * on fullscreen in Windows Vista and newer on nVidia and AMD drivers.
    */
    const bool canPreventFullScreen = (qstrcmp(w->metaObject()->className(), "QOpenGLWidget") != 0);
    const QSysInfo::WinVersion winVer = QSysInfo::windowsVersion();
    if (canPreventFullScreen && winVer >= QSysInfo::WV_6_0)
    {
        Qt::CheckState compositionEnabled;
        if (!preventFullScreen)
            compositionEnabled = Qt::PartiallyChecked;
        else
        {
            compositionEnabled = Qt::Checked;
            if (winVer <= QSysInfo::WV_6_1) //Windows 8 and 10 can't disable DWM composition
            {
                using DwmIsCompositionEnabledProc = HRESULT (WINAPI *)(BOOL *pfEnabled);
                DwmIsCompositionEnabledProc DwmIsCompositionEnabled = (DwmIsCompositionEnabledProc)GetProcAddress(GetModuleHandleA("dwmapi.dll"), "DwmIsCompositionEnabled");
                if (DwmIsCompositionEnabled)
                {
                    BOOL enabled = false;
                    if (DwmIsCompositionEnabled(&enabled) == S_OK && !enabled)
                        compositionEnabled = Qt::PartiallyChecked;
                }
            }
        }
        w->setProperty("preventFullScreen", (int)compositionEnabled);
    }
#endif
}
开发者ID:zaps166,项目名称:QMPlay2,代码行数:101,代码来源:OpenGL2Common.cpp


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