diff options
Diffstat (limited to 'examples/widgets/widgets/tablet')
-rw-r--r-- | examples/widgets/widgets/tablet/mainwindow.cpp | 6 | ||||
-rw-r--r-- | examples/widgets/widgets/tablet/tabletcanvas.cpp | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/examples/widgets/widgets/tablet/mainwindow.cpp b/examples/widgets/widgets/tablet/mainwindow.cpp index 8bcb9ada63..c5b631ee44 100644 --- a/examples/widgets/widgets/tablet/mainwindow.cpp +++ b/examples/widgets/widgets/tablet/mainwindow.cpp @@ -85,21 +85,21 @@ void MainWindow::setBrushColor() //! [2] void MainWindow::setAlphaValuator(QAction *action) { - m_canvas->setAlphaChannelValuator(action->data().value<TabletCanvas::Valuator>()); + m_canvas->setAlphaChannelValuator(qvariant_cast<TabletCanvas::Valuator>(action->data())); } //! [2] //! [3] void MainWindow::setLineWidthValuator(QAction *action) { - m_canvas->setLineWidthType(action->data().value<TabletCanvas::Valuator>()); + m_canvas->setLineWidthType(qvariant_cast<TabletCanvas::Valuator>(action->data())); } //! [3] //! [4] void MainWindow::setSaturationValuator(QAction *action) { - m_canvas->setColorSaturationValuator(action->data().value<TabletCanvas::Valuator>()); + m_canvas->setColorSaturationValuator(qvariant_cast<TabletCanvas::Valuator>(action->data())); } //! [4] diff --git a/examples/widgets/widgets/tablet/tabletcanvas.cpp b/examples/widgets/widgets/tablet/tabletcanvas.cpp index 59ca608cef..90a5017500 100644 --- a/examples/widgets/widgets/tablet/tabletcanvas.cpp +++ b/examples/widgets/widgets/tablet/tabletcanvas.cpp @@ -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; |