Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/doc/src/examples/tablet.qdoc

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the documentation of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4949
    5050    When you use a tablet with Qt applications, \l{QTabletEvent}s are
    51     genarated. You need to reimplement the
     51    generated. You need to reimplement the
    5252    \l{QWidget::}{tabletEvent()} event handler if you want to handle
    5353    tablet events. Events are generated when the device used for
     
    8080        \o The \c TabletCanvas class inherits QWidget and
    8181           receives tablet events. It uses the events to paint on a
    82            QImage, which it draws onto itself.
     82           offscreen pixmap, which it draws onto itself.
    8383        \o The \c TabletApplication class inherits QApplication. This
    8484           class handles tablet events that are not sent to \c tabletEvent().
     
    215215    which we provide access functions for.
    216216
    217     We draw on a QImage with \c myPen and \c myBrush using \c
     217    We draw on a QPixmap with \c myPen and \c myBrush using \c
    218218    myColor. The \c saveImage() and \c loadImage() saves and loads
    219     the QImage to disk. The image is drawn on the widget in \c
     219    the QPixmap to disk. The pixmap is drawn on the widget in \c
    220220    paintEvent(). The \c pointerType and \c deviceType keeps the type
    221221    of pointer, which is either a pen or an eraser, and device
     
    224224
    225225    The interpretation of events from the tablet is done in \c
    226     tabletEvent(); \c paintImage(), \c updateBrush(), and \c
     226    tabletEvent(); \c paintPixmap(), \c updateBrush(), and \c
    227227    brushPattern() are helper functions used by \c tabletEvent().
    228228
     
    235235
    236236    In the constructor we initialize our class variables. We need
    237     to draw the background of our image, as the default is gray.
     237    to draw the background of our pixmap, as the default is gray.
    238238
    239239    Here is the implementation of \c saveImage():
     
    241241    \snippet examples/widgets/tablet/tabletcanvas.cpp 1
    242242
    243     QImage implements functionality to save itself to disk, so we
    244     simply call \l{QImage::}{save()}.
     243    QPixmap implements functionality to save itself to disk, so we
     244    simply call \l{QPixmap::}{save()}.
    245245
    246246    Here is the implementation of \c loadImage():
     
    248248    \snippet examples/widgets/tablet/tabletcanvas.cpp 2
    249249
    250     We simply call \l{QImage::}{load()}, which loads the image in \a
     250    We simply call \l{QPixmap::}{load()}, which loads the image in \a
    251251    file.
    252252
     
    260260    deviceDown to true when a device is pressed down on the tablet;
    261261    we then know when we should draw when we receive move events. We
    262     have implemented the \c updateBrush() and \c paintImage() helper
     262    have implemented the \c updateBrush() and \c paintPixmap() helper
    263263    functions to update \c myBrush and \c myPen after the state of \c
    264264    alphaChannelType, \c colorSaturationType, and \c lineWidthType.
     
    268268    \snippet examples/widgets/tablet/tabletcanvas.cpp 4
    269269
    270     We simply draw the image to the top left of the widget.
    271 
    272     Here is the implementation of \c paintImage():
     270    We simply draw the pixmap to the top left of the widget.
     271
     272    Here is the implementation of \c paintPixmap():
    273273
    274274    \snippet examples/widgets/tablet/tabletcanvas.cpp 5
    275275
    276     In this function we draw on the image based on the movement of the
     276    In this function we draw on the pixmap based on the movement of the
    277277    device. If the device used on the tablet is a stylus we want to draw a
    278     line between the positions of the stylus recorded in \c polyLine.
     278    line between the positions of the stylus recorded in \c polyLine. We
     279    also assume that this is a reasonable handling of any unknown device,
     280    but update the statusbar with a warning so that the user can see that
     281    for his tablet he might have to implement special handling.
    279282    If it is an airbrush we want to draw a circle of points with a
    280283    point density based on the tangential pressure, which is the position
     
    332335    We finally check wether the pointer is the stylus or the eraser.
    333336    If it is the eraser, we set the color to the background color of
    334     the image an let the pressure decide the pen width, else we set
     337    the pixmap an let the pressure decide the pen width, else we set
    335338    the colors we have set up previously in the function.
    336339
Note: See TracChangeset for help on using the changeset viewer.