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 | |
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
-rw-r--r-- | doc/src/examples/tablet.qdoc | 5 | ||||
-rw-r--r-- | examples/widgets/tablet/tabletcanvas.cpp | 33 |
2 files changed, 29 insertions, 9 deletions
diff --git a/doc/src/examples/tablet.qdoc b/doc/src/examples/tablet.qdoc index e412815..61c140f 100644 --- a/doc/src/examples/tablet.qdoc +++ b/doc/src/examples/tablet.qdoc @@ -275,7 +275,10 @@ In this function we draw on the image based on the movement of the device. If the device used on the tablet is a stylus we want to draw a - line between the positions of the stylus recorded in \c polyLine. + line between the positions of the stylus recorded in \c polyLine. We + also assume that this is a reasonable handling of any unknown device, + but update the statusbar with a warning so that the user can see that + for his tablet he might have to implement special handling. If it is an airbrush we want to draw a circle of points with a point density based on the tangential pressure, which is the position of the finger wheel on the airbrush. We use the Qt::BrushStyle to 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(); |