diff options
author | Volker Hilsheimer <volker.hilsheimer@nokia.com> | 2009-07-16 09:47:34 (GMT) |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@nokia.com> | 2009-07-16 09:51:32 (GMT) |
commit | 14027d1b3d5c91e6d2ab87e5c08e32f469457053 (patch) | |
tree | fa40b2e8e7d3c3155d0072dd53ceb49137c64e2c /examples/widgets/tablet/tabletcanvas.cpp | |
parent | 9f32a101529cb518fb030df8ba8b818bbc9244c8 (diff) | |
download | Qt-14027d1b3d5c91e6d2ab87e5c08e32f469457053.zip Qt-14027d1b3d5c91e6d2ab87e5c08e32f469457053.tar.gz Qt-14027d1b3d5c91e6d2ab87e5c08e32f469457053.tar.bz2 |
Doc: show warnings about unrecognized or unsupported devices in the status
bar where TabletPC users can also see them.
Fixes: task 216859
Rev-by: TrustMe
Diffstat (limited to 'examples/widgets/tablet/tabletcanvas.cpp')
-rw-r--r-- | examples/widgets/tablet/tabletcanvas.cpp | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/examples/widgets/tablet/tabletcanvas.cpp b/examples/widgets/tablet/tabletcanvas.cpp index 4e8150e..3e9ae38 100644 --- a/examples/widgets/tablet/tabletcanvas.cpp +++ b/examples/widgets/tablet/tabletcanvas.cpp @@ -137,11 +137,6 @@ void TabletCanvas::paintImage(QPainter &painter, QTabletEvent *event) QPoint brushAdjust(10, 10); switch (myTabletDevice) { - case QTabletEvent::Stylus: - painter.setBrush(myBrush); - painter.setPen(myPen); - painter.drawLine(polyLine[1], event->pos()); - break; case QTabletEvent::Airbrush: myBrush.setColor(myColor); myBrush.setStyle(brushPattern(event->pressure())); @@ -156,10 +151,32 @@ void TabletCanvas::paintImage(QPainter &painter, QTabletEvent *event) case QTabletEvent::Puck: case QTabletEvent::FourDMouse: case QTabletEvent::RotationStylus: - qWarning("This input device is not supported by the example."); + { + const QString error(tr("This input device is not supported by the example.")); +#ifndef QT_NO_STATUSTIP + QStatusTipEvent status(error); + QApplication::sendEvent(this, &status); +#else + qWarning() << error; +#endif + } break; default: - qWarning("Unknown tablet device."); + { + const QString error(tr("Unknown tablet device - treating as stylus")); +#ifndef QT_NO_STATUSTIP + QStatusTipEvent status(error); + QApplication::sendEvent(this, &status); +#else + qWarning() << error; +#endif + } + // FALL-THROUGH + case QTabletEvent::Stylus: + painter.setBrush(myBrush); + painter.setPen(myPen); + painter.drawLine(polyLine[1], event->pos()); + break; } } //! [5] @@ -250,7 +267,7 @@ void TabletCanvas::updateBrush(QTabletEvent *event) } //! [11] -void TabletCanvas::resizeEvent(QResizeEvent *event) +void TabletCanvas::resizeEvent(QResizeEvent *) { initImage(); polyLine[0] = polyLine[1] = polyLine[2] = QPoint(); |