本文整理汇总了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
}
示例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
}