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
11QT_BEGIN_NAMESPACE
12
13class QtGradientManager;
14class QListViewItem;
15class QAction;
16
17class QtGradientView : public QWidget
18{
19 Q_OBJECT
20public:
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
29signals:
30 void currentGradientChanged(const QString &id);
31 void gradientActivated(const QString &id);
32
33private 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
46private:
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
59QT_END_NAMESPACE
60
61#endif
62

source code of qttools/src/shared/qtgradienteditor/qtgradientview.h