QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
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:
44 QgsGraduatedHistogramWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
45
51 void setRenderer( QgsGraduatedSymbolRenderer *renderer );
52
53 signals:
54
60 void rangesModified( bool rangesAdded );
61
62 protected:
63 void drawHistogram() override;
64
65 private slots:
66
67 void mousePress( double value );
68 void mouseRelease( double value );
69
70 private:
71 QgsGraduatedSymbolRenderer *mRenderer = nullptr;
72 QwtPlotPicker *mHistoPicker = nullptr;
73 QgsGraduatedHistogramEventFilter *mFilter = nullptr;
74 double mPressedValue = 0;
75
76 void findClosestRange( double value, int &closestRangeIndex, int &pixelDistance ) const;
77
78 QwtPlotHistogram *createPlotHistogram( const QString &title, const QColor &color ) const;
79};
80
81
82#ifndef SIP_RUN
83//
84// NOTE:
85// For private use by QgsGraduatedHistogramWidget only,
86// not part of stable api or exposed to Python bindings
87//
89class GUI_EXPORT QgsGraduatedHistogramEventFilter : public QObject
90{
91 Q_OBJECT
92
93 public:
94 QgsGraduatedHistogramEventFilter( QwtPlot *plot );
95
96 bool eventFilter( QObject *object, QEvent *event ) override;
97
98 signals:
99
100 void mousePress( double );
101 void mouseRelease( double );
102
103 private:
104 QwtPlot *mPlot = nullptr;
105 double posToValue( QPointF point ) const;
106};
108#endif
109
110#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.
A vector feature renderer which uses numeric attributes to classify features into different ranges.
Graphical histogram for displaying distributions of field values.
virtual void drawHistogram()
Updates and redraws the histogram.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53