1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | // |
5 | // W A R N I N G |
6 | // ------------- |
7 | // |
8 | // This file is not part of the Qt API. It exists for the convenience |
9 | // of Qt Designer. This header file may change from version to version |
10 | // without notice, or even be removed. |
11 | // |
12 | // We mean it. |
13 | // |
14 | |
15 | #ifndef QTGRADIENTWIDGET_H |
16 | #define QTGRADIENTWIDGET_H |
17 | |
18 | #include <QtWidgets/QWidget> |
19 | |
20 | QT_BEGIN_NAMESPACE |
21 | |
22 | class QtGradientWidget : public QWidget |
23 | { |
24 | Q_OBJECT |
25 | Q_PROPERTY(bool backgroundCheckered READ isBackgroundCheckered WRITE setBackgroundCheckered) |
26 | public: |
27 | QtGradientWidget(QWidget *parent = 0); |
28 | ~QtGradientWidget(); |
29 | |
30 | QSize minimumSizeHint() const override; |
31 | QSize sizeHint() const override; |
32 | int heightForWidth(int w) const override; |
33 | |
34 | bool isBackgroundCheckered() const; |
35 | void setBackgroundCheckered(bool checkered); |
36 | |
37 | QGradientStops gradientStops() const; |
38 | |
39 | void setGradientType(QGradient::Type type); |
40 | QGradient::Type gradientType() const; |
41 | |
42 | void setGradientSpread(QGradient::Spread spread); |
43 | QGradient::Spread gradientSpread() const; |
44 | |
45 | void setStartLinear(QPointF point); |
46 | QPointF startLinear() const; |
47 | |
48 | void setEndLinear(QPointF point); |
49 | QPointF endLinear() const; |
50 | |
51 | void setCentralRadial(QPointF point); |
52 | QPointF centralRadial() const; |
53 | |
54 | void setFocalRadial(QPointF point); |
55 | QPointF focalRadial() const; |
56 | |
57 | void setRadiusRadial(qreal radius); |
58 | qreal radiusRadial() const; |
59 | |
60 | void setCentralConical(QPointF point); |
61 | QPointF centralConical() const; |
62 | |
63 | void setAngleConical(qreal angle); |
64 | qreal angleConical() const; |
65 | |
66 | public slots: |
67 | void setGradientStops(const QGradientStops &stops); |
68 | |
69 | signals: |
70 | |
71 | void startLinearChanged(const QPointF &point); |
72 | void endLinearChanged(const QPointF &point); |
73 | void centralRadialChanged(const QPointF &point); |
74 | void focalRadialChanged(const QPointF &point); |
75 | void radiusRadialChanged(qreal radius); |
76 | void centralConicalChanged(const QPointF &point); |
77 | void angleConicalChanged(qreal angle); |
78 | |
79 | protected: |
80 | void paintEvent(QPaintEvent *e) override; |
81 | void mousePressEvent(QMouseEvent *e) override; |
82 | void mouseReleaseEvent(QMouseEvent *e) override; |
83 | void mouseMoveEvent(QMouseEvent *e) override; |
84 | void mouseDoubleClickEvent(QMouseEvent *e) override; |
85 | |
86 | private: |
87 | QScopedPointer<class QtGradientWidgetPrivate> d_ptr; |
88 | Q_DECLARE_PRIVATE(QtGradientWidget) |
89 | Q_DISABLE_COPY_MOVE(QtGradientWidget) |
90 | }; |
91 | |
92 | QT_END_NAMESPACE |
93 | |
94 | #endif |
95 | |