本文整理汇总了C++中qtouchevent::TouchPoint::pressure方法的典型用法代码示例。如果您正苦于以下问题:C++ TouchPoint::pressure方法的具体用法?C++ TouchPoint::pressure怎么用?C++ TouchPoint::pressure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtouchevent::TouchPoint
的用法示例。
在下文中一共展示了TouchPoint::pressure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: touchStateToString
QDebug operator<<(QDebug dbg, const QTouchEvent::TouchPoint &s)
{
dbg.nospace() << "\"TouchPoint\":"
<< "{ \"id\":" << s.id()
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
<< ", \"primary\":\"" << (s.isPrimary() ? "true" : "false") << "\""
#endif
<< ", \"state\":" << touchStateToString(s.state())
<< ", \"pos\":\"" << s.pos() << "\""
<< ", \"pressure\":\"" << s.pressure() << "\""
<< " }";
return dbg.space();
}
示例2:
PlatformTouchPoint::PlatformTouchPoint(const QTouchEvent::TouchPoint& point, State state)
// The QTouchEvent::TouchPoint API states that ids will be >= 0.
: m_id(point.id())
, m_state(state)
, m_screenPos(point.screenPos().toPoint())
, m_pos(point.pos().toPoint())
{
// Qt reports touch point size as rectangles, but we will pretend it is an oval.
QRect touchRect = point.rect().toAlignedRect();
if (touchRect.isValid()) {
m_radiusX = point.rect().width() / 2;
m_radiusY = point.rect().height() / 2;
} else {
// http://www.w3.org/TR/2011/WD-touch-events-20110505: 1 if no value is known.
m_radiusX = 1;
m_radiusY = 1;
}
m_force = point.pressure();
// FIXME: Support m_rotationAngle if QTouchEvent at some point supports it.
}