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 GRADIENTVIEW_H |
5 | #define GRADIENTVIEW_H |
6 | |
7 | #include <QtWidgets/QWidget> |
8 | #include <QtCore/QHash> |
9 | #include "ui_qtgradientview.h" |
10 | |
11 | QT_BEGIN_NAMESPACE |
12 | |
13 | class QtGradientManager; |
14 | class QListViewItem; |
15 | class QAction; |
16 | |
17 | class QtGradientView : public QWidget |
18 | { |
19 | Q_OBJECT |
20 | public: |
21 | QtGradientView(QWidget *parent = 0); |
22 | |
23 | void setGradientManager(QtGradientManager *manager); |
24 | QtGradientManager *gradientManager() const; |
25 | |
26 | void setCurrentGradient(const QString &id); |
27 | QString currentGradient() const; |
28 | |
29 | signals: |
30 | void currentGradientChanged(const QString &id); |
31 | void gradientActivated(const QString &id); |
32 | |
33 | private slots: |
34 | void slotGradientAdded(const QString &id, const QGradient &gradient); |
35 | void slotGradientRenamed(const QString &id, const QString &newId); |
36 | void slotGradientChanged(const QString &id, const QGradient &newGradient); |
37 | void slotGradientRemoved(const QString &id); |
38 | void slotNewGradient(); |
39 | void slotEditGradient(); |
40 | void slotRemoveGradient(); |
41 | void slotRenameGradient(); |
42 | void slotRenameGradientItem(QListWidgetItem *item); |
43 | void slotCurrentItemChanged(QListWidgetItem *item); |
44 | void slotGradientActivated(QListWidgetItem *item); |
45 | |
46 | private: |
47 | QHash<QString, QListWidgetItem *> m_idToItem; |
48 | QHash<QListWidgetItem *, QString> m_itemToId; |
49 | |
50 | QAction *m_newAction; |
51 | QAction *m_editAction; |
52 | QAction *m_renameAction; |
53 | QAction *m_removeAction; |
54 | |
55 | QtGradientManager *m_manager; |
56 | Ui::QtGradientView m_ui; |
57 | }; |
58 | |
59 | QT_END_NAMESPACE |
60 | |
61 | #endif |
62 |