2022-05-10 10:06:48 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#ifndef SCRIBBLEAREA_H
|
|
|
|
#define SCRIBBLEAREA_H
|
|
|
|
|
|
|
|
#include <QColor>
|
|
|
|
#include <QImage>
|
|
|
|
#include <QPoint>
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
//! [0]
|
|
|
|
class ScribbleArea : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2019-09-06 21:24:56 +00:00
|
|
|
ScribbleArea(QWidget *parent = nullptr);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
bool openImage(const QString &fileName);
|
|
|
|
bool saveImage(const QString &fileName, const char *fileFormat);
|
|
|
|
|
|
|
|
bool isModified() const { return modified; }
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void clearImage();
|
|
|
|
void print();
|
|
|
|
|
|
|
|
protected:
|
2016-06-15 08:12:35 +00:00
|
|
|
void paintEvent(QPaintEvent *event) override;
|
|
|
|
void resizeEvent(QResizeEvent *event) override;
|
|
|
|
bool event(QEvent *event) override;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void resizeImage(QImage *image, const QSize &newSize);
|
|
|
|
|
|
|
|
bool modified;
|
|
|
|
QList<QColor> myPenColors;
|
|
|
|
QImage image;
|
|
|
|
};
|
|
|
|
//! [0]
|
|
|
|
|
|
|
|
#endif
|