mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2024-11-23 12:07:03 +08:00
47 lines
990 B
C++
47 lines
990 B
C++
// Copyright (C) 2016 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
|
|
|
#ifndef RENDERAREA_H
|
|
#define RENDERAREA_H
|
|
|
|
#include <QBrush>
|
|
#include <QPen>
|
|
#include <QPixmap>
|
|
#include <QWidget>
|
|
|
|
//! [0]
|
|
class RenderArea : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
enum Shape { Line, Points, Polyline, Polygon, Rect, RoundedRect, Ellipse, Arc,
|
|
Chord, Pie, Path, Text, Pixmap };
|
|
|
|
explicit RenderArea(QWidget *parent = nullptr);
|
|
|
|
QSize minimumSizeHint() const override;
|
|
QSize sizeHint() const override;
|
|
|
|
public slots:
|
|
void setShape(Shape shape);
|
|
void setPen(const QPen &pen);
|
|
void setBrush(const QBrush &brush);
|
|
void setAntialiased(bool antialiased);
|
|
void setTransformed(bool transformed);
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent *event) override;
|
|
|
|
private:
|
|
Shape shape;
|
|
QPen pen;
|
|
QBrush brush;
|
|
bool antialiased;
|
|
bool transformed;
|
|
QPixmap pixmap;
|
|
};
|
|
//! [0]
|
|
|
|
#endif // RENDERAREA_H
|