scribblearea.h Example File | Qt 4.8 (original) (raw)

widgets/scribble/scribblearea.h

#ifndef SCRIBBLEAREA_H #define SCRIBBLEAREA_H

#include #include #include #include

class ScribbleArea : public QWidget { Q_OBJECT

public: ScribbleArea(QWidget *parent = 0);

bool openImage(const [QString](qstring.html) &fileName);
bool saveImage(const [QString](qstring.html) &fileName, const char *fileFormat);
void setPenColor(const [QColor](qcolor.html) &newColor);
void setPenWidth(int newWidth);

bool isModified() const { return modified; }
[QColor](qcolor.html) penColor() const { return myPenColor; }
int penWidth() const { return myPenWidth; }

public slots: void clearImage(); void print();

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](qcolor.html) myPenColor;
[QImage](qimage.html) image;
[QPoint](qpoint.html) lastPoint;

};

#endif

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.