1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef PAINTER_H
#define PAINTER_H

#include <QWidget>
#include <QPixmap>
#include <QPainter>

class QPaintEvent;
class QMouseEvent;

#include <vector>
using std::vector;


class Painter:public QWidget{
    //setAcceptDrops(true);
public:
    Painter(QWidget *parent = 0):QWidget(parent){
        pixImg = new QPixmap("C:\\Qt\\2010.05\\qt\\Test_QPixmap\\test.jpg");
        isGood = false;
        //timer = 0;
    }
    ~Painter(){ delete [] pixImg;}
    inline void show(){ }

protected:

    void paintEvent(QPaintEvent*);

    void mousePressEvent( QMouseEvent *e );
    void mouseReleaseEvent( QMouseEvent *e );
    void mouseMoveEvent( QMouseEvent *e );
    //void resizeEvent( QResizeEvent *e );
    //void paintEvent( QPaintEvent *e );

private:
    QPixmap *pixImg;
    bool isGood;
};

#endif // PAINTER_H