LibreCAD
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
colorselect.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <QComboBox>
4 #include <QString>
5 #include <QColor>
6 #include <QColorDialog>
7 
8 #include <cad/meta/metacolor.h>
9 #include <cad/meta/layer.h>
11 
12 #define BY_BLOCK "ByBlock"
13 #define BY_LAYER "ByLayer"
14 #define CUSTOM "Custom"
15 
16 namespace lc {
17  namespace ui {
22  class ColorSelect : public QComboBox {
23  Q_OBJECT
24 
25  public:
32  ColorSelect(lc::ui::MetaInfoManager_SPtr metaInfoManager = nullptr,
33  QWidget* parent = 0,
34  bool showByLayer = false, bool showByBlock = false);
35 
40  void setMetaInfoManager(lc::ui::MetaInfoManager_SPtr metaInfoManager = nullptr);
41 
46  lc::MetaColor_CSPtr metaColor();
47 
52  lc::Color color();
53 
59  void setColor(lc::Color color);
60 
61  public slots:
67  void onLayerChanged(lc::Layer_CSPtr layer);
68 
69  private slots:
70  void onActivated(const QString& text);
71  void on_customColorChanged(const QColor& color);
72 
73  private:
74  void updateMetaInfoManager();
75 
76  QSize qIconSize;
77  QColor _customColor;
78  lc::ui::MetaInfoManager_SPtr _metaInfoManager;
79  };
80  }
81 }
lc::Color color()
Returns selected color.
void onActivated(const QString &text)
Definition: colorselect.cpp:37
void onLayerChanged(lc::Layer_CSPtr layer)
Event when a new layer is selected.
Definition: colorselect.cpp:65
lc::ui::MetaInfoManager_SPtr _metaInfoManager
Definition: colorselect.h:78
void setColor(lc::Color color)
Set selected color.
Definition: colorselect.cpp:78
void on_customColorChanged(const QColor &color)
Definition: colorselect.cpp:53
lc::MetaColor_CSPtr metaColor()
Returns selected color.
void setMetaInfoManager(lc::ui::MetaInfoManager_SPtr metaInfoManager=nullptr)
Set the MetaInfo manager.
Definition: colorselect.cpp:86
ColorSelect(lc::ui::MetaInfoManager_SPtr metaInfoManager=nullptr, QWidget *parent=0, bool showByLayer=false, bool showByBlock=false)
Create widget.
Definition: colorselect.cpp:6