QGIS API Documentation 3.99.0-Master (26c88405ac0)
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 "qgis_gui.h"
21#include "qgis_sip.h"
22#include "qgshistogramwidget.h"
23
24class QwtPlotPicker;
25class QgsGraduatedHistogramEventFilter;
26
34
36{
37 Q_OBJECT
38
39 public:
40
45 QgsGraduatedHistogramWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
46
53
54 signals:
55
61 void rangesModified( bool rangesAdded );
62
63 protected:
64 void drawHistogram() override;
65
66 private slots:
67
68 void mousePress( double value );
69 void mouseRelease( double value );
70
71 private:
72 QgsGraduatedSymbolRenderer *mRenderer = nullptr;
73 QwtPlotPicker *mHistoPicker = nullptr;
74 QgsGraduatedHistogramEventFilter *mFilter = nullptr;
75 double mPressedValue = 0;
76
77 void findClosestRange( double value, int &closestRangeIndex, int &pixelDistance ) const;
78
79 QwtPlotHistogram *createPlotHistogram( const QString &title, const QColor &color ) const;
80};
81
82
83#ifndef SIP_RUN
84//
85// NOTE:
86// For private use by QgsGraduatedHistogramWidget only,
87// not part of stable api or exposed to Python bindings
88//
90class GUI_EXPORT QgsGraduatedHistogramEventFilter : public QObject
91{
92 Q_OBJECT
93
94 public:
95 QgsGraduatedHistogramEventFilter( QwtPlot *plot );
96
97 bool eventFilter( QObject *object, QEvent *event ) override;
98
99 signals:
100
101 void mousePress( double );
102 void mouseRelease( double );
103
104 private:
105 QwtPlot *mPlot = nullptr;
106 double posToValue( QPointF point ) const;
107};
109#endif
110
111#endif //QGSGRADUATEDHISTOGRAMWIDGET_H
void rangesModified(bool rangesAdded)
Emitted when the user modifies the graduated ranges using the histogram widget.
QgsGraduatedHistogramWidget(QWidget *parent=nullptr)
QgsGraduatedHistogramWidget constructor.
void setRenderer(QgsGraduatedSymbolRenderer *renderer)
Sets the QgsGraduatedSymbolRenderer renderer associated with the histogram.
A vector feature renderer which uses numeric attributes to classify features into different ranges.
QgsHistogramWidget(QWidget *parent=nullptr, QgsVectorLayer *layer=nullptr, const QString &fieldOrExp=QString())
QgsHistogramWidget constructor.
virtual void drawHistogram()
Updates and redraws the histogram.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53