OpenMS
ColorSelector.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 //QT
15 #include <QtWidgets/QWidget>
16 
17 class QPaintEvent;
18 class QMouseEvent;
19 
20 namespace OpenMS
21 {
22 
34  class OPENMS_GUI_DLLAPI ColorSelector :
35  public QWidget
36  {
37  Q_OBJECT
38 
39 public:
41  ColorSelector(QWidget * parent = nullptr);
42 
44  ~ColorSelector() override;
45 
47  const QColor & getColor();
48 
50  void setColor(const QColor &);
51 
53  QSize sizeHint() const override;
54 protected:
56 
57  void paintEvent(QPaintEvent * e) override;
58  void mousePressEvent(QMouseEvent * e) override;
60  QColor color_;
61  };
62 
63 }
A widget for selecting a color.
Definition: ColorSelector.h:36
const QColor & getColor()
Returns the selected color.
QSize sizeHint() const override
Qt size hint.
void mousePressEvent(QMouseEvent *e) override
QColor color_
Definition: ColorSelector.h:60
~ColorSelector() override
Destructor.
ColorSelector(QWidget *parent=nullptr)
Constructor.
void setColor(const QColor &)
Sets the selected color.
void paintEvent(QPaintEvent *e) override
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22