Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 #ifndef QMITK_COLORPROPERTYEDITOR_H_INCLUDED
17 #define QMITK_COLORPROPERTYEDITOR_H_INCLUDED
18 
20 #include "QmitkColorPropertyView.h"
21 #include <QFrame>
22 #include <mitkColorProperty.h>
23 
24 class QListBox;
25 
28 {
29  Q_OBJECT
30 
31 public:
32  QmitkPopupColorChooser(QWidget *parent = nullptr, unsigned int steps = 16, unsigned int size = 150);
33  virtual ~QmitkPopupColorChooser();
34 
35  void setSteps(int);
36 
37  virtual void popup(QWidget *parent,
38  const QPoint &point,
39  const mitk::Color * = nullptr);
40 
41 signals:
42 
43  void colorSelected(QColor);
44 
45 protected:
46  virtual void keyReleaseEvent(QKeyEvent *) override;
47 
48  virtual void mouseMoveEvent(QMouseEvent *) override;
49  virtual void mouseReleaseEvent(QMouseEvent *) override;
50  virtual void closeEvent(QCloseEvent *) override;
51 
52  virtual void paintEvent(QPaintEvent *) override;
53  void drawGradient(QPainter *p);
54 
55 private:
56  QWidget *m_popupParent;
57  QWidget *my_parent;
58 
59  unsigned int m_Steps;
60  unsigned int m_Steps2;
61  unsigned int m_HStep;
62  unsigned int m_SStep;
63  unsigned int m_VStep;
64 
65  int m_H;
66  int m_S;
67  int m_V;
68  QColor m_OriginalColor;
69 };
70 
73 {
74  Q_OBJECT
75 
76 public:
77  QmitkColorPropertyEditor(const mitk::ColorProperty *, QWidget *parent);
78  virtual ~QmitkColorPropertyEditor();
79 
80 protected:
81  virtual void mousePressEvent(QMouseEvent *) override;
82  virtual void mouseReleaseEvent(QMouseEvent *) override;
83 
86 
87 protected slots:
88 
89  void onColorSelected(QColor);
90 
91 private:
92 };
93 
94 #endif
#define MITKQTWIDGETSEXT_EXPORT
The ColorProperty class RGB color property.
static QmitkPopupColorChooser * colorChooser
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)