QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
qgsgraduatedhistogramwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsgraduatedhistogramwidget.h
3 -----------------------------
4 begin : May 2015
5 copyright : (C) 2015 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#ifndef QGSGRADUATEDHISTOGRAMWIDGET_H
18#define QGSGRADUATEDHISTOGRAMWIDGET_H
19
20#include "qgshistogramwidget.h"
21#include "qgis_sip.h"
22#include "qgis_gui.h"
23
24class QwtPlotPicker;
25class QgsGraduatedHistogramEventFilter;
26
36{
37 Q_OBJECT
38
39 public:
40
45 QgsGraduatedHistogramWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
46
52 void setRenderer( QgsGraduatedSymbolRenderer *renderer );
53
54 signals:
55
61 void rangesModified( bool rangesAdded );
62
63 protected:
64
65 void drawHistogram() override;
66
67 private slots:
68
69 void mousePress( double value );
70 void mouseRelease( double value );
71
72 private:
73
74 QgsGraduatedSymbolRenderer *mRenderer = nullptr;
75 QwtPlotPicker *mHistoPicker = nullptr;
76 QgsGraduatedHistogramEventFilter *mFilter = nullptr;
77 double mPressedValue = 0;
78
79 void findClosestRange( double value, int &closestRangeIndex, int &pixelDistance ) const;
80
81 QwtPlotHistogram *createPlotHistogram( const QString &title, const QColor &color ) const;
82
83};
84
85
86#ifndef SIP_RUN
87//
88// NOTE:
89// For private use by QgsGraduatedHistogramWidget only,
90// not part of stable api or exposed to Python bindings
91//
93class GUI_EXPORT QgsGraduatedHistogramEventFilter: public QObject
94{
95 Q_OBJECT
96
97 public:
98
99 QgsGraduatedHistogramEventFilter( QwtPlot *plot );
100
101 bool eventFilter( QObject *object, QEvent *event ) override;
102
103 signals:
104
105 void mousePress( double );
106 void mouseRelease( double );
107
108 private:
109
110 QwtPlot *mPlot = nullptr;
111 double posToValue( QPointF point ) const;
112};
114#endif
115
116#endif //QGSGRADUATEDHISTOGRAMWIDGET_H
Graphical histogram for displaying distribution of field values and editing range breaks for a QgsGra...
void rangesModified(bool rangesAdded)
Emitted when the user modifies the graduated ranges using the histogram widget.
Graphical histogram for displaying distributions of field values.
virtual void drawHistogram()
Updates and redraws the histogram.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53