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 | #ifndef QTGRADIENTSTOPSWIDGET_H |
5 | #define QTGRADIENTSTOPSWIDGET_H |
6 | |
7 | #include <QtWidgets/QAbstractScrollArea> |
8 | |
9 | QT_BEGIN_NAMESPACE |
10 | |
11 | class QtGradientStopsModel; |
12 | class QtGradientStopsWidgetPrivate; |
13 | |
14 | class QtGradientStopsWidget : public QAbstractScrollArea |
15 | { |
16 | Q_OBJECT |
17 | Q_PROPERTY(bool backgroundCheckered READ isBackgroundCheckered WRITE setBackgroundCheckered) |
18 | public: |
19 | QtGradientStopsWidget(QWidget *parent = 0); |
20 | ~QtGradientStopsWidget(); |
21 | |
22 | QSize minimumSizeHint() const override; |
23 | QSize sizeHint() const override; |
24 | |
25 | bool isBackgroundCheckered() const; |
26 | void setBackgroundCheckered(bool checkered); |
27 | |
28 | void setGradientStopsModel(QtGradientStopsModel *model); |
29 | |
30 | void setZoom(double zoom); |
31 | double zoom() const; |
32 | |
33 | signals: |
34 | void zoomChanged(double zoom); |
35 | |
36 | protected: |
37 | void paintEvent(QPaintEvent *e) override; |
38 | void mousePressEvent(QMouseEvent *e) override; |
39 | void mouseReleaseEvent(QMouseEvent *e) override; |
40 | void mouseMoveEvent(QMouseEvent *e) override; |
41 | void mouseDoubleClickEvent(QMouseEvent *e) override; |
42 | void keyPressEvent(QKeyEvent *e) override; |
43 | void focusInEvent(QFocusEvent *e) override; |
44 | void focusOutEvent(QFocusEvent *e) override; |
45 | void contextMenuEvent(QContextMenuEvent *e) override; |
46 | void wheelEvent(QWheelEvent *e) override; |
47 | #ifndef QT_NO_DRAGANDDROP |
48 | void dragEnterEvent(QDragEnterEvent *event) override; |
49 | void dragMoveEvent(QDragMoveEvent *event) override; |
50 | void dragLeaveEvent(QDragLeaveEvent *event) override; |
51 | void dropEvent(QDropEvent *event) override; |
52 | #endif |
53 | |
54 | private: |
55 | QScopedPointer<QtGradientStopsWidgetPrivate> d_ptr; |
56 | Q_DECLARE_PRIVATE(QtGradientStopsWidget) |
57 | Q_DISABLE_COPY_MOVE(QtGradientStopsWidget) |
58 | }; |
59 | |
60 | QT_END_NAMESPACE |
61 | |
62 | #endif |
63 |