Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qtgradientwidget_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5//
6// W A R N I N G
7// -------------
8//
9// This file is not part of the Qt API. It exists for the convenience
10// of Qt Designer. This header file may change from version to version
11// without notice, or even be removed.
12//
13// We mean it.
14//
15
16#ifndef QTGRADIENTWIDGET_H
17#define QTGRADIENTWIDGET_H
18
19#include <QtWidgets/qwidget.h>
20
21QT_BEGIN_NAMESPACE
22
23class QtGradientWidget : public QWidget
24{
25 Q_OBJECT
26 Q_PROPERTY(bool backgroundCheckered READ isBackgroundCheckered WRITE setBackgroundCheckered)
27public:
28 explicit QtGradientWidget(QWidget *parent = nullptr);
29 ~QtGradientWidget() override;
30
31 QSize minimumSizeHint() const override;
32 QSize sizeHint() const override;
33 int heightForWidth(int w) const override;
34
35 bool isBackgroundCheckered() const;
36 void setBackgroundCheckered(bool checkered);
37
38 QGradientStops gradientStops() const;
39
40 void setGradientType(QGradient::Type type);
41 QGradient::Type gradientType() const;
42
43 void setGradientSpread(QGradient::Spread spread);
44 QGradient::Spread gradientSpread() const;
45
46 void setStartLinear(QPointF point);
47 QPointF startLinear() const;
48
49 void setEndLinear(QPointF point);
50 QPointF endLinear() const;
51
52 void setCentralRadial(QPointF point);
53 QPointF centralRadial() const;
54
55 void setFocalRadial(QPointF point);
56 QPointF focalRadial() const;
57
58 void setRadiusRadial(qreal radius);
59 qreal radiusRadial() const;
60
61 void setCentralConical(QPointF point);
62 QPointF centralConical() const;
63
64 void setAngleConical(qreal angle);
65 qreal angleConical() const;
66
67public slots:
68 void setGradientStops(const QGradientStops &stops);
69
70signals:
71
72 void startLinearChanged(const QPointF &point);
73 void endLinearChanged(const QPointF &point);
74 void centralRadialChanged(const QPointF &point);
75 void focalRadialChanged(const QPointF &point);
76 void radiusRadialChanged(qreal radius);
77 void centralConicalChanged(const QPointF &point);
78 void angleConicalChanged(qreal angle);
79
80protected:
81 void paintEvent(QPaintEvent *e) override;
82 void mousePressEvent(QMouseEvent *e) override;
83 void mouseReleaseEvent(QMouseEvent *e) override;
84 void mouseMoveEvent(QMouseEvent *e) override;
85 void mouseDoubleClickEvent(QMouseEvent *e) override;
86
87private:
88 QScopedPointer<class QtGradientWidgetPrivate> d_ptr;
89 Q_DECLARE_PRIVATE(QtGradientWidget)
90 Q_DISABLE_COPY_MOVE(QtGradientWidget)
91};
92
93QT_END_NAMESPACE
94
95#endif
QPointF checkRange(QPointF point) const
QPointF toViewport(QPointF point) const
QGradient::Spread m_gradientSpread
void paintPoint(QPainter *painter, QPointF point, double size) const
void setAngleConical(double angle)
QRectF pointRect(QPointF point, double size) const
double correctAngle(double angle) const
Combined button and popup list for selecting options.
constexpr double qRadiansToDegrees(double radians)
Definition qmath.h:278