Medical Imaging Interaction Toolkit  2023.12.99-5f0d6a86
Medical Imaging Interaction Toolkit
QmitkColorPropertyEditor.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 #ifndef QmitkColorPropertyEditor_h
13 #define QmitkColorPropertyEditor_h
14 
16 #include "QmitkColorPropertyView.h"
17 #include <QFrame>
18 #include <mitkColorProperty.h>
19 
20 class QListBox;
21 
24 {
25  Q_OBJECT
26 
27 public:
28  QmitkPopupColorChooser(QWidget *parent = nullptr, unsigned int steps = 16, unsigned int size = 150);
29  ~QmitkPopupColorChooser() override;
30 
31  void setSteps(int);
32 
33  virtual void popup(QWidget *parent,
34  const QPoint &point,
35  const mitk::Color * = nullptr);
36 
37 signals:
38 
39  void colorSelected(QColor);
40 
41 protected:
42  void keyReleaseEvent(QKeyEvent *) override;
43 
44  void mouseMoveEvent(QMouseEvent *) override;
45  void mouseReleaseEvent(QMouseEvent *) override;
46  void closeEvent(QCloseEvent *) override;
47 
48  void paintEvent(QPaintEvent *) override;
49  void drawGradient(QPainter *p);
50 
51 private:
52  QWidget *m_popupParent;
53  QWidget *my_parent;
54 
55  unsigned int m_Steps;
56  unsigned int m_Steps2;
57  unsigned int m_HStep;
58  unsigned int m_SStep;
59  unsigned int m_VStep;
60 
61  int m_H;
62  int m_S;
63  int m_V;
64  QColor m_OriginalColor;
65 };
66 
69 {
70  Q_OBJECT
71 
72 public:
73  QmitkColorPropertyEditor(const mitk::ColorProperty *, QWidget *parent);
74  ~QmitkColorPropertyEditor() override;
75 
76 protected:
77  void mousePressEvent(QMouseEvent *) override;
78  void mouseReleaseEvent(QMouseEvent *) override;
79 
82 
83 protected slots:
84 
85  void onColorSelected(QColor);
86 
87 private:
88 };
89 
90 #endif
QmitkColorPropertyEditor::colorChooserRefCount
static int colorChooserRefCount
Definition: QmitkColorPropertyEditor.h:81
MITKQTWIDGETSEXT_EXPORT
#define MITKQTWIDGETSEXT_EXPORT
Definition: MitkQtWidgetsExtExports.h:15
mitk::Color
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
Definition: mitkColorProperty.h:38
QmitkPopupColorChooser
Definition: QmitkColorPropertyEditor.h:23
mitk::ColorProperty
The ColorProperty class RGB color property.
Definition: mitkColorProperty.h:50
QmitkColorPropertyEditor
Definition: QmitkColorPropertyEditor.h:68
QmitkColorPropertyView.h
QmitkColorPropertyView
Definition: QmitkColorPropertyView.h:21
MitkQtWidgetsExtExports.h
mitkColorProperty.h
QmitkColorPropertyEditor::colorChooser
static QmitkPopupColorChooser * colorChooser
Definition: QmitkColorPropertyEditor.h:80