src/gui/graphicsview/qgraphicstransform.h
changeset 0 1918ee327afb
child 3 41300fa6a67c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the QtGui module of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    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.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef QGRAPHICSTRANSFORM_H
       
    43 #define QGRAPHICSTRANSFORM_H
       
    44 
       
    45 #include <QtCore/QObject>
       
    46 #include <QtGui/QVector3D>
       
    47 #include <QtGui/QTransform>
       
    48 #include <QtGui/QMatrix4x4>
       
    49 
       
    50 QT_BEGIN_HEADER
       
    51 
       
    52 QT_BEGIN_NAMESPACE
       
    53 
       
    54 QT_MODULE(Gui)
       
    55 
       
    56 class QGraphicsItem;
       
    57 class QGraphicsTransformPrivate;
       
    58 
       
    59 class Q_GUI_EXPORT QGraphicsTransform : public QObject
       
    60 {
       
    61     Q_OBJECT
       
    62 public:
       
    63     QGraphicsTransform(QObject *parent = 0);
       
    64     ~QGraphicsTransform();
       
    65 
       
    66     virtual void applyTo(QMatrix4x4 *matrix) const = 0;
       
    67 
       
    68 protected Q_SLOTS:
       
    69     void update();
       
    70 
       
    71 protected:
       
    72     QGraphicsTransform(QGraphicsTransformPrivate &p, QObject *parent);
       
    73 
       
    74 private:
       
    75     friend class QGraphicsItem;
       
    76     friend class QGraphicsItemPrivate;
       
    77     Q_DECLARE_PRIVATE(QGraphicsTransform)
       
    78 };
       
    79 
       
    80 class QGraphicsScalePrivate;
       
    81 
       
    82 class Q_GUI_EXPORT QGraphicsScale : public QGraphicsTransform
       
    83 {
       
    84     Q_OBJECT
       
    85 
       
    86     Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged)
       
    87     Q_PROPERTY(qreal xScale READ xScale WRITE setXScale NOTIFY scaleChanged)
       
    88     Q_PROPERTY(qreal yScale READ yScale WRITE setYScale NOTIFY scaleChanged)
       
    89     Q_PROPERTY(qreal zScale READ zScale WRITE setZScale NOTIFY scaleChanged)
       
    90 public:
       
    91     QGraphicsScale(QObject *parent = 0);
       
    92     ~QGraphicsScale();
       
    93 
       
    94     QVector3D origin() const;
       
    95     void setOrigin(const QVector3D &point);
       
    96 
       
    97     qreal xScale() const;
       
    98     void setXScale(qreal);
       
    99 
       
   100     qreal yScale() const;
       
   101     void setYScale(qreal);
       
   102 
       
   103     qreal zScale() const;
       
   104     void setZScale(qreal);
       
   105 
       
   106     void applyTo(QMatrix4x4 *matrix) const;
       
   107 
       
   108 Q_SIGNALS:
       
   109     void originChanged();
       
   110     void scaleChanged();
       
   111 
       
   112 private:
       
   113     Q_DECLARE_PRIVATE(QGraphicsScale)
       
   114 };
       
   115 
       
   116 class QGraphicsRotationPrivate;
       
   117 
       
   118 class Q_GUI_EXPORT QGraphicsRotation : public QGraphicsTransform
       
   119 {
       
   120     Q_OBJECT
       
   121 
       
   122     Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged)
       
   123     Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged)
       
   124     Q_PROPERTY(QVector3D axis READ axis WRITE setAxis NOTIFY axisChanged)
       
   125 public:
       
   126     QGraphicsRotation(QObject *parent = 0);
       
   127     ~QGraphicsRotation();
       
   128 
       
   129     QVector3D origin() const;
       
   130     void setOrigin(const QVector3D &point);
       
   131 
       
   132     qreal angle() const;
       
   133     void setAngle(qreal);
       
   134 
       
   135     QVector3D axis() const;
       
   136     void setAxis(const QVector3D &axis);
       
   137     void setAxis(Qt::Axis axis);
       
   138 
       
   139     void applyTo(QMatrix4x4 *matrix) const;
       
   140 
       
   141 Q_SIGNALS:
       
   142     void originChanged();
       
   143     void angleChanged();
       
   144     void axisChanged();
       
   145 
       
   146 private:
       
   147     Q_DECLARE_PRIVATE(QGraphicsRotation)
       
   148 };
       
   149 
       
   150 QT_END_NAMESPACE
       
   151 
       
   152 QT_END_HEADER
       
   153 
       
   154 #endif // QFXTRANSFORM_H