joint.h
Go to the documentation of this file.
00001 #ifndef JOINT_H
00002 #define JOINT_H
00003 /****************************************************************************
00004 **
00005 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
00006 ** All rights reserved.
00007 ** Contact: Nokia Corporation (qt-info@nokia.com)
00008 **
00009 ** This file is part of the examples of the Qt Toolkit.
00010 **
00011 ** $QT_BEGIN_LICENSE:BSD$
00012 ** You may use this file under the terms of the BSD license as follows:
00013 **
00014 ** "Redistribution and use in source and binary forms, with or without
00015 ** modification, are permitted provided that the following conditions are
00016 ** met:
00017 **   * Redistributions of source code must retain the above copyright
00018 **     notice, this list of conditions and the following disclaimer.
00019 **   * Redistributions in binary form must reproduce the above copyright
00020 **     notice, this list of conditions and the following disclaimer in
00021 **     the documentation and/or other materials provided with the
00022 **     distribution.
00023 **   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
00024 **     the names of its contributors may be used to endorse or promote
00025 **     products derived from this software without specific prior written
00026 **     permission.
00027 **
00028 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00029 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00030 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00031 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00032 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00033 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00034 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00035 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00036 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00037 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00038 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
00039 ** $QT_END_LICENSE$
00040 **
00041 ****************************************************************************/
00042 
00043 #include <QGraphicsItem>
00044  #include <QList>
00045 
00046  class ArmWidget;
00047  class ArmRotationWidget;
00048  class QGraphicsSceneMouseEvent;
00049 
00050  class joint : public QGraphicsItem
00051  {
00052  public:
00053      joint(ArmWidget *graphWidget);
00054      joint(ArmRotationWidget *graphWidget);
00055 
00056      bool advance(); //update the position of the joint
00057 
00058      QRectF boundingRect() const;
00059      QPainterPath shape() const;
00060      void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
00061 
00062  protected:
00063      QVariant itemChange(GraphicsItemChange change, const QVariant &value); // Request update of the parent graph
00064      void mousePressEvent(QGraphicsSceneMouseEvent *event);
00065      void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
00066 
00067  private:
00068      QPointF newPos;
00069      ArmWidget *graph;
00070      ArmRotationWidget *graph_rotation;
00071  };
00072 
00073 #endif // JOINT_H


corobot_teleop
Author(s):
autogenerated on Wed Aug 26 2015 11:09:59