All Classes Namespaces Functions Variables Enumerations Properties Pages
colorinspector.h
1 /*
2 
3 Pencil2D - Traditional Animation Software
4 Copyright (C) 2012-2020 Matthew Chiawen Chang
5 
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; version 2 of the License.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 */
16 #ifndef COLORSPINBOXGROUP_H
17 #define COLORSPINBOXGROUP_H
18 
19 #include <QPaintEvent>
20 #include "basedockwidget.h"
21 
22 namespace Ui {
23 class ColorInspector;
24 }
25 
27 {
28  Q_OBJECT
29 
30  friend class ColorSliders;
31 
32 public:
33  explicit ColorInspector(QWidget *parent = nullptr);
34  ~ColorInspector() override;
35  QColor color();
36 
37  void initUI() override;
38  void updateUI() override;
39 
40 signals:
41  void colorChanged(const QColor& c);
42  void colorSpecChanged(const bool& isRgb);
43 
44 public slots:
45  void setColor(QColor newColor);
46 
47 private slots:
48  void onColorSpecChanged();
49  void onColorChanged();
50  void onColorChanged(const QColor& color);
51 
52 private:
53  void updateControls();
54 
55  Ui::ColorInspector* ui = nullptr;
56  bool isRgbColors = true;
57  QColor mCurrentColor;
58 };
59 
60 #endif // COLORSPINBOXGROUP_H
Q_OBJECTQ_OBJECT
QObject * parent() const const