source: trunk/demos/affine/xform.h@ 846

Last change on this file since 846 was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 4.3 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the demonstration applications of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
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** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef XFORM_H
43#define XFORM_H
44
45#include "arthurwidgets.h"
46
47#include <QBasicTimer>
48#include <QPolygonF>
49
50class HoverPoints;
51QT_FORWARD_DECLARE_CLASS(QLineEdit)
52
53class XFormView : public ArthurFrame
54{
55public:
56 Q_OBJECT
57
58 Q_PROPERTY(XFormType type READ type WRITE setType)
59 Q_PROPERTY(bool animation READ animation WRITE setAnimation)
60 Q_PROPERTY(qreal shear READ shear WRITE setShear)
61 Q_PROPERTY(qreal rotation READ rotation WRITE setRotation)
62 Q_PROPERTY(qreal scale READ scale WRITE setScale)
63 Q_PROPERTY(QString text READ text WRITE setText)
64 Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
65 Q_ENUMS(XFormType)
66
67public:
68 enum XFormType { VectorType, PixmapType, TextType };
69
70 XFormView(QWidget *parent);
71 void paint(QPainter *);
72 void drawVectorType(QPainter *painter);
73 void drawPixmapType(QPainter *painter);
74 void drawTextType(QPainter *painter);
75 QSize sizeHint() const { return QSize(500, 500); }
76
77 void mousePressEvent(QMouseEvent *e);
78 void resizeEvent(QResizeEvent *e);
79 HoverPoints *hoverPoints() { return pts; }
80
81 bool animation() const { return timer.isActive(); }
82 qreal shear() const { return m_shear; }
83 qreal scale() const { return m_scale; }
84 qreal rotation() const { return m_rotation; }
85 void setShear(qreal s);
86 void setScale(qreal s);
87 void setRotation(qreal r);
88
89 XFormType type() const;
90 QPixmap pixmap() const;
91 QString text() const;
92
93public slots:
94 void setAnimation(bool animate);
95 void updateCtrlPoints(const QPolygonF &);
96 void changeRotation(int rotation);
97 void changeScale(int scale);
98 void changeShear(int shear);
99
100 void setText(const QString &);
101 void setPixmap(const QPixmap &);
102 void setType(XFormType t);
103
104 void setVectorType();
105 void setPixmapType();