| 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 GRADIENTMANAGER_H | 
| 16 | #define GRADIENTMANAGER_H | 
| 17 |  | 
| 18 | #include <QtCore/QObject> | 
| 19 | #include <QtCore/QMap> | 
| 20 | #include <QtCore/QSize> | 
| 21 | #include <QtXml/QDomDocument> | 
| 22 | #include <QtXml/QDomElement> | 
| 23 | #include <QtGui/QGradient> | 
| 24 |  | 
| 25 | QT_BEGIN_NAMESPACE | 
| 26 |  | 
| 27 | class QGradient; | 
| 28 | class QPixmap; | 
| 29 | class QColor; | 
| 30 |  | 
| 31 | class QtGradientManager : public QObject | 
| 32 | { | 
| 33 |     Q_OBJECT | 
| 34 | public: | 
| 35 |     QtGradientManager(QObject *parent = 0); | 
| 36 |  | 
| 37 |     QMap<QString, QGradient> gradients() const; | 
| 38 |  | 
| 39 |     QString uniqueId(const QString &id) const; | 
| 40 |  | 
| 41 | public slots: | 
| 42 |  | 
| 43 |     QString addGradient(const QString &id, const QGradient &gradient); | 
| 44 |     void renameGradient(const QString &id, const QString &newId); | 
| 45 |     void changeGradient(const QString &id, const QGradient &newGradient); | 
| 46 |     void removeGradient(const QString &id); | 
| 47 |  | 
| 48 |     //utils | 
| 49 |     void clear(); | 
| 50 |  | 
| 51 | signals: | 
| 52 |  | 
| 53 |     void gradientAdded(const QString &id, const QGradient &gradient); | 
| 54 |     void gradientRenamed(const QString &id, const QString &newId); | 
| 55 |     void gradientChanged(const QString &id, const QGradient &newGradient); | 
| 56 |     void gradientRemoved(const QString &id); | 
| 57 |  | 
| 58 | private: | 
| 59 |  | 
| 60 |     QMap<QString, QGradient> m_idToGradient; | 
| 61 | }; | 
| 62 |  | 
| 63 | QT_END_NAMESPACE | 
| 64 |  | 
| 65 | #endif | 
| 66 |  |