📄 paint.h
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -