WristWidget.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
00006 **
00007 ** This file is part of the examples of the Qt Toolkit.
00008 **
00009 ** $QT_BEGIN_LICENSE:BSD$
00010 ** You may use this file under the terms of the BSD license as follows:
00011 **
00012 ** "Redistribution and use in source and binary forms, with or without
00013 ** modification, are permitted provided that the following conditions are
00014 ** met:
00015 **   * Redistributions of source code must retain the above copyright
00016 **     notice, this list of conditions and the following disclaimer.
00017 **   * Redistributions in binary form must reproduce the above copyright
00018 **     notice, this list of conditions and the following disclaimer in
00019 **     the documentation and/or other materials provided with the
00020 **     distribution.
00021 **   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
00022 **     the names of its contributors may be used to endorse or promote
00023 **     products derived from this software without specific prior written
00024 **     permission.
00025 **
00026 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00027 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00028 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00029 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00030 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00031 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00032 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00033 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00034 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00035 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00036 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
00037 ** $QT_END_LICENSE$
00038 **
00039 ****************************************************************************/
00040 
00041 #ifndef WRISTWIDGET_H
00042 #define WRISTWIDGET_H
00043 
00044 #include <QtGui/QGraphicsView>
00045 #include "Line.h"
00046 
00047 
00048 class WristWidget : public QGraphicsView
00049  {
00050      Q_OBJECT
00051 
00052  public:
00053      WristWidget(QWidget *parent = 0);
00054 
00055 public slots:
00056      void degree(bool value);//if value is true, emit the signal angle in degree,else in radian
00057      void angleReceived(double value);//set a new value for the wrist angle
00058      void turnCounterClockwise();//turn the wrist counter clockwise
00059      void turnClockwise();//turn the wrist clockwise
00060 
00061  protected:
00062      void timerEvent(QTimerEvent *event);
00063      void drawBackground(QPainter *painter, const QRectF &rect);
00064      void scaleView(qreal scaleFactor);//scale the view
00065 
00066  private:
00067      int timerId;
00068      double wristAngle;
00069      bool angle_type;
00070 
00071  signals:
00072      void angle(double value);//wrist angle in degree or radian depending on the angle_type value
00073      void angle_rad(float value);//wrist angle in radian
00074 
00075 
00076  };
00077 
00078 
00079 
00080 #endif // WRISTWIDGET_H
00081 


corobot_teleop
Author(s): Morgan Cormier/Gang Li/mcormier@coroware.com
autogenerated on Tue Jan 7 2014 11:39:41