Debian Codegraph @

tests/manual/examples/svggenerator/displaywidget.h

raw
1 // Copyright (C) 2017 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4 #ifndef DISPLAYWIDGET_H
5 #define DISPLAYWIDGET_H
6
7 #include <QColor>
8 #include <QHash>
9 #include <QPainterPath>
10 #include <QWidget>
11
12 //! [DisplayWidget class definition]
13 class DisplayWidget : public QWidget
14 {
15 Q_OBJECT
16
17 public:
18 enum Shape { House = 0, Car = 1 };
19 enum Background { Sky = 0, Trees = 1, Road = 2 };
20
21 DisplayWidget(QWidget *parent = 0);
22 QColor color() const;
23 void paint(QPainter &painter);
24
25 public slots:
26 void setBackground(Background background);
27 void setColor(const QColor &color);
28 void setShape(Shape shape);
29
30 protected:
31 void paintEvent(QPaintEvent *event) override;
32
33 private:
34 Background background;
35 QColor shapeColor;
36 Shape shape;
37 QHash<Shape,QPainterPath> shapeMap;
38 QPainterPath moon;
39 QPainterPath tree;
40 };
41 //! [DisplayWidget class definition]
42
43 #endif