drawarea.h

来自「Qt4 程序集合」· C头文件 代码 · 共 37 行

H
37
字号
#ifndef _DRAWAREA_H#define _DRAWAREA_H#include <QColor>#include <QImage>#include <QPoint>#include <QWidget>class DrawArea : public QWidget{    Q_OBJECTpublic:    DrawArea(QWidget *parent = 0);    bool isModified() const { return modified; }    void clearImage();protected:    void mousePressEvent(QMouseEvent *event);    void mouseMoveEvent(QMouseEvent *event);    void mouseReleaseEvent(QMouseEvent *event);    void paintEvent(QPaintEvent *event);    void resizeEvent(QResizeEvent *event);private:    void drawLineTo(const QPoint &endPoint);    void resizeImage(QImage *image, const QSize &newSize);    bool modified;    bool scribbling;    int myPenWidth;    QColor myPenColor;    QImage image;    QPoint lastPoint;};#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?