Deprecate QTabletEvent::device() in favor of deviceType()
The idea is to reserve device() to return a pointer to a QInputDevice in the future, which is in sync with QQuickPointerEvent::device() and with QTouchEvent::device(). Change-Id: Ifda6e8aea72d5121955b31bdcbd91bf1bfa4cec4 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
352c8ef199
commit
882f340f62
@ -106,7 +106,7 @@ void TabletCanvas::tabletEvent(QTabletEvent *event)
|
||||
break;
|
||||
case QEvent::TabletMove:
|
||||
#ifndef Q_OS_IOS
|
||||
if (event->device() == QTabletEvent::RotationStylus)
|
||||
if (event->deviceType() == QTabletEvent::RotationStylus)
|
||||
updateCursor(event);
|
||||
#endif
|
||||
if (m_deviceDown) {
|
||||
@ -161,7 +161,7 @@ void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event)
|
||||
static qreal maxPenRadius = pressureToWidth(1.0);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
switch (event->device()) {
|
||||
switch (event->deviceType()) {
|
||||
//! [6]
|
||||
case QTabletEvent::Airbrush:
|
||||
{
|
||||
@ -251,7 +251,7 @@ void TabletCanvas::updateBrush(const QTabletEvent *event)
|
||||
m_color.setAlphaF(event->pressure());
|
||||
break;
|
||||
case TangentialPressureValuator:
|
||||
if (event->device() == QTabletEvent::Airbrush)
|
||||
if (event->deviceType() == QTabletEvent::Airbrush)
|
||||
m_color.setAlphaF(qMax(0.01, (event->tangentialPressure() + 1.0) / 2.0));
|
||||
else
|
||||
m_color.setAlpha(255);
|
||||
@ -312,7 +312,7 @@ void TabletCanvas::updateCursor(const QTabletEvent *event)
|
||||
if (event->pointerType() == QTabletEvent::Eraser) {
|
||||
cursor = QCursor(QPixmap(":/images/cursor-eraser.png"), 3, 28);
|
||||
} else {
|
||||
switch (event->device()) {
|
||||
switch (event->deviceType()) {
|
||||
case QTabletEvent::Stylus:
|
||||
cursor = QCursor(QPixmap(":/images/cursor-pencil.png"), 0, 0);
|
||||
break;
|
||||
|
@ -2454,6 +2454,12 @@ Qt::MouseButtons QTabletEvent::buttons() const
|
||||
/*!
|
||||
\fn TabletDevices QTabletEvent::device() const
|
||||
|
||||
\deprecated Use deviceType().
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn TabletDevices QTabletEvent::deviceType() const
|
||||
|
||||
Returns the type of device that generated the event.
|
||||
|
||||
\sa TabletDevice
|
||||
|
@ -312,8 +312,10 @@ public:
|
||||
inline qreal hiResGlobalX() const { return mGPos.x(); }
|
||||
QT_DEPRECATED_VERSION_X_5_15("use globalPosF().y()")
|
||||
inline qreal hiResGlobalY() const { return mGPos.y(); }
|
||||
#endif
|
||||
QT_DEPRECATED_VERSION_X_5_15("Use deviceType()")
|
||||
inline TabletDevice device() const { return TabletDevice(mDev); }
|
||||
#endif
|
||||
inline TabletDevice deviceType() const { return TabletDevice(mDev); }
|
||||
inline PointerType pointerType() const { return PointerType(mPointerType); }
|
||||
inline qint64 uniqueId() const { return mUnique; }
|
||||
inline qreal pressure() const { return mPress; }
|
||||
|
@ -3299,7 +3299,7 @@ QT_WARNING_POP
|
||||
bool eventAccepted = tablet->isAccepted();
|
||||
while (w) {
|
||||
QTabletEvent te(tablet->type(), relpos, tablet->globalPosF(),
|
||||
tablet->device(), tablet->pointerType(),
|
||||
tablet->deviceType(), tablet->pointerType(),
|
||||
tablet->pressure(), tablet->xTilt(), tablet->yTilt(),
|
||||
tablet->tangentialPressure(), tablet->rotation(), tablet->z(),
|
||||
tablet->modifiers(), tablet->uniqueId(), tablet->button(), tablet->buttons());
|
||||
|
Loading…
Reference in New Issue
Block a user