Last change
on this file since 20 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.8 KB
|
Line | |
---|
1 | /****************************************************************************
|
---|
2 | ** $Id: scribble.h 2 2005-11-16 15:49:26Z dmik $
|
---|
3 | **
|
---|
4 | ** Copyright ( C ) 1992-2000 Trolltech AS. All rights reserved.
|
---|
5 | **
|
---|
6 | ** This file is part of an example program for Qt. This example
|
---|
7 | ** program may be used, distributed and modified without limitation.
|
---|
8 | **
|
---|
9 | *****************************************************************************/
|
---|
10 |
|
---|
11 | #ifndef SCRIBBLE_H
|
---|
12 | #define SCRIBBLE_H
|
---|
13 |
|
---|
14 | #include <qmainwindow.h>
|
---|
15 | #include <qpen.h>
|
---|
16 | #include <qpoint.h>
|
---|
17 | #include <qpixmap.h>
|
---|
18 | #include <qwidget.h>
|
---|
19 | #include <qstring.h>
|
---|
20 | #include <qpointarray.h>
|
---|
21 |
|
---|
22 | class QMouseEvent;
|
---|
23 | class QResizeEvent;
|
---|
24 | class QPaintEvent;
|
---|
25 | class QToolButton;
|
---|
26 | class QSpinBox;
|
---|
27 |
|
---|
28 | class Canvas : public QWidget
|
---|
29 | {
|
---|
30 | Q_OBJECT
|
---|
31 |
|
---|
32 | public:
|
---|
33 | Canvas( QWidget *parent = 0, const char *name = 0 );
|
---|
34 |
|
---|
35 | void setPenColor( const QColor &c )
|
---|
36 | { pen.setColor( c ); }
|
---|
37 |
|
---|
38 | void setPenWidth( int w )
|
---|
39 | { pen.setWidth( w ); }
|
---|
40 |
|
---|
41 | QColor penColor()
|
---|
42 | { return pen.color(); }
|
---|
43 |
|
---|
44 | int penWidth()
|
---|
45 | { return pen.width(); }
|
---|
46 |
|
---|
47 | void save( const QString &filename, const QString &format );
|
---|
48 |
|
---|
49 | void clearScreen();
|
---|
50 |
|
---|
51 | protected:
|
---|
52 | void mousePressEvent( QMouseEvent *e );
|
---|
53 | void mouseReleaseEvent( QMouseEvent *e );
|
---|
54 | void mouseMoveEvent( QMouseEvent *e );
|
---|
55 | void resizeEvent( QResizeEvent *e );
|
---|
56 | void paintEvent( QPaintEvent *e );
|
---|
57 |
|
---|
58 | QPen pen;
|
---|
59 | QPointArray polyline;
|
---|
60 |
|
---|
61 | bool mousePressed;
|
---|
62 |
|
---|
63 | QPixmap buffer;
|
---|
64 |
|
---|
65 | };
|
---|
66 |
|
---|
67 | class Scribble : public QMainWindow
|
---|
68 | {
|
---|
69 | Q_OBJECT
|
---|
70 |
|
---|
71 | public:
|
---|
72 | Scribble( QWidget *parent = 0, const char *name = 0 );
|
---|
73 |
|
---|
74 | protected:
|
---|
75 | Canvas* canvas;
|
---|
76 |
|
---|
77 | QSpinBox *bPWidth;
|
---|
78 | QToolButton *bPColor, *bSave, *bClear;
|
---|
79 |
|
---|
80 | protected slots:
|
---|
81 | void slotSave();
|
---|
82 | void slotColor();
|
---|
83 | void slotWidth( int );
|
---|
84 | void slotClear();
|
---|
85 |
|
---|
86 | };
|
---|
87 |
|
---|
88 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.