~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to demos/deform/pathdeform.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef PATHDEFORM_H
 
2
#define PATHDEFORM_H
 
3
 
 
4
#include "arthurwidgets.h"
 
5
 
 
6
#include <qevent.h>
 
7
#include <qpainterpath.h>
 
8
#include <qbasictimer.h>
 
9
#include <qdatetime.h>
 
10
 
 
11
class PathDeformRenderer : public ArthurFrame
 
12
{
 
13
    Q_OBJECT
 
14
public:
 
15
    PathDeformRenderer(QWidget *widget);
 
16
 
 
17
    void paint(QPainter *painter);
 
18
 
 
19
    void mousePressEvent(QMouseEvent *e);
 
20
    void mouseReleaseEvent(QMouseEvent *e);
 
21
    void mouseMoveEvent(QMouseEvent *e);
 
22
    void timerEvent(QTimerEvent *e);
 
23
 
 
24
    QSize sizeHint() const { return QSize(600, 500); }
 
25
 
 
26
public slots:
 
27
    void setRadius(int radius);
 
28
    void setFontSize(int fontSize) { m_fontSize = fontSize; setText(m_text); }
 
29
    void setText(const QString &text);
 
30
    void setIntensity(int intensity);
 
31
 
 
32
    void setAnimated(bool animated);
 
33
 
 
34
// signals:
 
35
//     void frameRate(double fps);
 
36
 
 
37
private:
 
38
    void generateLensPixmap();
 
39
    QPainterPath lensDeform(const QPainterPath &source, const QPointF &offset);
 
40
 
 
41
    QBasicTimer m_repaintTimer;
 
42
//     QBasicTimer m_fpsTimer;
 
43
//     int m_fpsCounter;
 
44
    QTime m_repaintTracker;
 
45
 
 
46
    QVector<QPainterPath> m_paths;
 
47
    QVector<QPointF> m_advances;
 
48
    QRectF m_pathBounds;
 
49
    QString m_text;
 
50
 
 
51
    QPixmap m_lens_pixmap;
 
52
    QImage m_lens_image;
 
53
 
 
54
    int m_fontSize;
 
55
    bool m_animated;
 
56
 
 
57
    double m_intensity;
 
58
    double m_radius;
 
59
    QPointF m_pos;
 
60
    QPointF m_offset;
 
61
    QPointF m_direction;
 
62
};
 
63
 
 
64
class PathDeformWidget : public QWidget
 
65
{
 
66
public:
 
67
    PathDeformWidget(QWidget *parent);
 
68
 
 
69
private:
 
70
    PathDeformRenderer *m_renderer;
 
71
};
 
72
 
 
73
#endif // PATHDEFORM_H