OpenMS
Loading...
Searching...
No Matches
HistogramWidget.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- 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>
16#include <QPixmap>
17class QPaintEvent;
18class QResizeEvent;
19class QMouseEvent;
20
21//OpenMS
23
24namespace OpenMS
25{
26 class AxisWidget;
27
38 class OPENMS_GUI_DLLAPI HistogramWidget :
39 public QWidget
40 {
41 Q_OBJECT
42
43public:
45 HistogramWidget(const Math::Histogram<> & distribution, QWidget * parent = nullptr);
46
48 ~HistogramWidget() override;
49
51 double getLeftSplitter() const;
52
54 double getRightSplitter() const;
55
57 void setLegend(const std::string & legend);
58
59public slots:
61 void showSplitters(bool on);
62
64 void setRightSplitter(double pos);
65
67 void setLeftSplitter(double pos);
68
70 void setLogMode(bool log_mode);
71
72protected:
75
78
81
84
87
90
93
95 QPixmap buffer_;
96
99
102
104
105 void paintEvent(QPaintEvent *) override;
106 void mousePressEvent(QMouseEvent *) override;
107 void mouseReleaseEvent(QMouseEvent *) override;
108 void mouseMoveEvent(QMouseEvent *) override;
109 void resizeEvent(QResizeEvent *) override;
111
112protected slots:
113
115 void showContextMenu(const QPoint & pos);
116 };
117} // namespace OpenMS
118
119
Widget that represents an axis of a graph.
Definition AxisWidget.h:39
Definition HistogramWidget.h:40
void invalidate_()
Repaints the contents to the buffer and calls update()
HistogramWidget(const Math::Histogram<> &distribution, QWidget *parent=nullptr)
Constructor.
void paintEvent(QPaintEvent *) override
void setLegend(const std::string &legend)
Set axis legends.
UInt margin_
Margin around plot.
Definition HistogramWidget.h:92
void showContextMenu(const QPoint &pos)
Context menu event.
void setLeftSplitter(double pos)
Sets the value of the left splitter.
void mousePressEvent(QMouseEvent *) override
void resizeEvent(QResizeEvent *) override
UInt moving_splitter_
The splitter that is currently dragged (0=none, 1=left, 2=right)
Definition HistogramWidget.h:86
void setLogMode(bool log_mode)
Enables/disables log mode.
bool log_mode_
Flag that indicates the current mode.
Definition HistogramWidget.h:98
double getLeftSplitter() const
Returns the value f the lower splitter.
double getRightSplitter() const
Returns the value of the upper splitter.
double left_splitter_
Value of the right splitter.
Definition HistogramWidget.h:80
void showSplitters(bool on)
Shows the splitters if on is true. Hides them otherwise.
QPixmap buffer_
Internal buffer for the double buffering.
Definition HistogramWidget.h:95
bool show_splitters_
Flag that indicates if splitters are shown.
Definition HistogramWidget.h:77
void mouseMoveEvent(QMouseEvent *) override
AxisWidget * bottom_axis_
X axis.
Definition HistogramWidget.h:89
void mouseReleaseEvent(QMouseEvent *) override
Math::Histogram dist_
The histogram to display.
Definition HistogramWidget.h:74
~HistogramWidget() override
Destructor.
double right_splitter_
Value of the right splitter.
Definition HistogramWidget.h:83
void setRightSplitter(double pos)
Sets the value of the right splitter.
Representation of a histogram.
Definition Histogram.h:38
unsigned int UInt
Unsigned integer type.
Definition Types.h:64
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19