paint.h
来自「une tres bonne fenetre」· C头文件 代码 · 共 50 行
H
50 行
#ifndef Head_paint
#define Head_paint
#include <QWidget>
#include <QImage>
#include <QColor>
#include <QMainWindow>
#include <QPushButton>
class paint : public QWidget
{
Q_OBJECT
public:
paint(int w,int h,QString fichier,QColor coleur,QWidget *parent=0);
bool openImage(const QString &fileName);
bool saveImage(const QString &fileName);
void setPenColor(const QColor &newColor);
void setPenWidth(int newWidth);
bool isModified() const { return modified; }
QColor penColor() const { return myPenColor; }
int penWidth() const { return myPenWidth; }
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;
QPushButton *ok;
QColor myPenColor;
QImage image;
QPoint lastPoint;
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?