src/widgets/colorbutton.h

Thu, 20 Jun 2019 08:54:35 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 20 Jun 2019 08:54:35 +0300
changeset 1440
265b2e95a8e8
parent 1395
23551de3da36
permissions
-rw-r--r--

uuid things

1395
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 /*
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3 * Copyright (C) 2013 - 2018 Teemu Piippo
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 *
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 * (at your option) any later version.
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9 *
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 * GNU General Public License for more details.
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 *
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17 */
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 #pragma once
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 #include "../main.h"
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21 #include "../colors.h"
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
22 #include <QPushButton>
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 class ColorButton : public QPushButton
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 {
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
26 Q_OBJECT
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
27
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 public:
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
29 explicit ColorButton(LDColor color, QWidget* parent = nullptr);
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
30 explicit ColorButton(QWidget* parent = nullptr);
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
31
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
32 LDColor color() const;
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
33 void setColor(LDColor color);
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
34
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
35 signals:
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
36 void colorChanged(LDColor color);
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
37
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
38 private:
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
39 LDColor _color;
23551de3da36 separated the color button into a new widget
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
40 };

mercurial