Last change
on this file since 25 was 2, checked in by dmik, 20 years ago |
Imported xplatform parts of the official release 3.3.1 from Trolltech
|
-
Property svn:keywords
set to
Id
|
File size:
1.1 KB
|
Line | |
---|
1 | /****************************************************************
|
---|
2 | **
|
---|
3 | ** Definition of CannonField class, Qt tutorial 11
|
---|
4 | **
|
---|
5 | ****************************************************************/
|
---|
6 |
|
---|
7 | #ifndef CANNON_H
|
---|
8 | #define CANNON_H
|
---|
9 |
|
---|
10 | class QTimer;
|
---|
11 |
|
---|
12 |
|
---|
13 | #include <qwidget.h>
|
---|
14 |
|
---|
15 |
|
---|
16 | class CannonField : public QWidget
|
---|
17 | {
|
---|
18 | Q_OBJECT
|
---|
19 | public:
|
---|
20 | CannonField( QWidget *parent=0, const char *name=0 );
|
---|
21 |
|
---|
22 | int angle() const { return ang; }
|
---|
23 | int force() const { return f; }
|
---|
24 | QSizePolicy sizePolicy() const;
|
---|
25 |
|
---|
26 | public slots:
|
---|
27 | void setAngle( int degrees );
|
---|
28 | void setForce( int newton );
|
---|
29 | void shoot();
|
---|
30 |
|
---|
31 | private slots:
|
---|
32 | void moveShot();
|
---|
33 |
|
---|
34 | signals:
|
---|
35 | void angleChanged( int );
|
---|
36 | void forceChanged( int );
|
---|
37 |
|
---|
38 | protected:
|
---|
39 | void paintEvent( QPaintEvent * );
|
---|
40 |
|
---|
41 | private:
|
---|
42 | void paintShot( QPainter * );
|
---|
43 | void paintCannon( QPainter * );
|
---|
44 | QRect cannonRect() const;
|
---|
45 | QRect shotRect() const;
|
---|
46 |
|
---|
47 | int ang;
|
---|
48 | int f;
|
---|
49 |
|
---|
50 | int timerCount;
|
---|
51 | QTimer * autoShootTimer;
|
---|
52 | float shoot_ang;
|
---|
53 | float shoot_f;
|
---|
54 | };
|
---|
55 |
|
---|
56 |
|
---|
57 | #endif // CANNON_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.