OpenMS
MultiGradientSelector.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg$
6 // $Authors: Marc Sturm $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 // OpenMS_GUI config
12 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
13 
14 //OpenMS
15 #include <OpenMS/CONCEPT/Types.h>
17 
18 //QT
19 #include <QtWidgets>
20 
21 class QPaintEvent;
22 class QMouseEvent;
23 class QKeyEvent;
24 class QContextMenuEvent;
25 
26 //std lib
27 #include <vector>
28 
29 namespace OpenMS
30 {
31 
41  class OPENMS_GUI_DLLAPI MultiGradientSelector :
42  public QWidget
43  {
44  Q_OBJECT
45 public:
47  MultiGradientSelector(QWidget * parent = nullptr);
50 
52  const MultiGradient & gradient() const;
55 
60 
61 public slots:
63  void stairsInterpolation(bool state);
64 
65 protected:
67 
68  void paintEvent(QPaintEvent * e) override;
69  void mousePressEvent(QMouseEvent * e) override;
70  void mouseMoveEvent(QMouseEvent * e) override;
71  void mouseReleaseEvent(QMouseEvent * e) override;
72  void mouseDoubleClickEvent(QMouseEvent * e) override;
73  void keyPressEvent(QKeyEvent * e) override;
74  void contextMenuEvent(QContextMenuEvent * e) override;
76 
77  // the actual gradient
79 
80  // border margin
82  // height of the gradient area
84  // height of the lever area
86 
87  //position (0-100) in the vector of the selected lever
89  //color of the selected lever
91 
92  //stores if the left button is pressed
94  };
95 
96 }
A widget witch allows constructing gradients of multiple colors.
Definition: MultiGradientSelector.h:43
void setInterpolationMode(MultiGradient::InterpolationMode mode)
sets the interpolation mode
Int selected_
Definition: MultiGradientSelector.h:88
~MultiGradientSelector() override
Destructor.
Int margin_
Definition: MultiGradientSelector.h:81
bool left_button_pressed_
Definition: MultiGradientSelector.h:93
void mousePressEvent(QMouseEvent *e) override
MultiGradientSelector(QWidget *parent=nullptr)
Constructor.
void mouseMoveEvent(QMouseEvent *e) override
void mouseReleaseEvent(QMouseEvent *e) override
Int gradient_area_width_
Definition: MultiGradientSelector.h:83
void keyPressEvent(QKeyEvent *e) override
const MultiGradient & gradient() const
returns a const reference to the gradient
MultiGradient::InterpolationMode getInterpolationMode() const
returns the interpolation mode
MultiGradient gradient_
Definition: MultiGradientSelector.h:78
QColor selected_color_
Definition: MultiGradientSelector.h:90
void contextMenuEvent(QContextMenuEvent *e) override
Int lever_area_height_
Definition: MultiGradientSelector.h:85
void mouseDoubleClickEvent(QMouseEvent *e) override
MultiGradient & gradient()
returns a mutable reference to the gradient
void paintEvent(QPaintEvent *e) override
void stairsInterpolation(bool state)
sets what interpolation mode is used
A gradient of multiple colors and arbitrary distances between colors.
Definition: MultiGradient.h:42
InterpolationMode
Interpolation mode.
Definition: MultiGradient.h:52
int Int
Signed integer type.
Definition: Types.h:76
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22