Tulip 5.7.1
Large graphs analysis and drawing
Loading...
Searching...
No Matches
ColorButton.h
1/*
2 *
3 * This file is part of Tulip (https://tulip.labri.fr)
4 *
5 * Authors: David Auber and the Tulip development Team
6 * from LaBRI, University of Bordeaux
7 *
8 * Tulip is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation, either version 3
11 * of the License, or (at your option) any later version.
12 *
13 * Tulip is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 * See the GNU General Public License for more details.
17 *
18 */
19///@cond DOXYGEN_HIDDEN
20
21#ifndef COLORBUTTON_H
22#define COLORBUTTON_H
23
24#include <QPushButton>
25
26#include <tulip/tulipconf.h>
27#include <tulip/Color.h>
28#include <tulip/TulipMetaTypes.h>
29
30namespace tlp {
31
32class TLP_QT_SCOPE ColorButton : public QPushButton {
33 Q_OBJECT
34 Q_PROPERTY(QColor color READ color WRITE setColor)
35 Q_PROPERTY(Color tulipColor READ tulipColor WRITE setTulipColor)
36
37public:
38 explicit ColorButton(QWidget *parent = nullptr);
39
40 QColor color() const;
41 QString text() const;
42 Color tulipColor() const;
43
44public slots:
45 void setColor(const QColor &);
46 void setText(const QString &text);
47 void setTulipColor(const Color &);
48 void setDialogTitle(const QString &);
49
50signals:
51 void colorChanged(QColor);
52 void tulipColorChanged(Color);
53
54protected:
55 QColor _color;
56 QString _text;
57 QString _dialogTitle;
58
59 void paintEvent(QPaintEvent *) override;
60
61protected slots:
62 void chooseColor();
63};
64
65} // namespace tlp
66
67#endif // COLORBUTTON_H
68///@endcond