| 1 |
// Copyright (C) 2016 The Qt Company Ltd. |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause |
| 3 |
|
| 4 |
#ifndef RENDERAREA_H |
| 5 |
#define RENDERAREA_H |
| 6 |
|
| 7 |
#include <QPainterPath> |
| 8 |
#include <QWidget> |
| 9 |
|
| 10 |
//! [0] |
| 11 |
class RenderArea : public QWidget |
| 12 |
{ |
| 13 |
Q_OBJECT |
| 14 |
|
| 15 |
public: |
| 16 |
explicit RenderArea(const QPainterPath &path, QWidget *parent = nullptr); |
| 17 |
|
| 18 |
QSize minimumSizeHint() const override; |
| 19 |
QSize sizeHint() const override; |
| 20 |
|
| 21 |
public slots: |
| 22 |
void setFillRule(Qt::FillRule rule); |
| 23 |
void setFillGradient(const QColor &color1, const QColor &color2); |
| 24 |
void setPenWidth(int width); |
| 25 |
void setPenColor(const QColor &color); |
| 26 |
void setRotationAngle(int degrees); |
| 27 |
|
| 28 |
protected: |
| 29 |
void paintEvent(QPaintEvent *event) override; |
| 30 |
//! [0] |
| 31 |
|
| 32 |
//! [1] |
| 33 |
private: |
| 34 |
QPainterPath path; |
| 35 |
QColor fillColor1; |
| 36 |
QColor fillColor2; |
| 37 |
int penWidth; |
| 38 |
QColor penColor; |
| 39 |
int rotationAngle; |
| 40 |
}; |
| 41 |
//! [1] |
| 42 |
|
| 43 |
#endif // RENDERAREA_H |