QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgselevationcontrollerwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgselevationcontrollerwidget.h
3 ---------------
4 begin : March 2024
5 copyright : (C) 2024 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
18#ifndef QGSELEVATIONCONTROLLERWIDGET_H
19#define QGSELEVATIONCONTROLLERWIDGET_H
20
21#include "qgis_gui.h"
22#include "qgis_sip.h"
23#include "qgsrange.h"
24
25#include <QWidget>
26#include <QWidgetAction>
27
28class QgsRangeSlider;
30class QToolButton;
31class QMenu;
32
34
35class GUI_EXPORT QgsElevationControllerLabels : public QWidget SIP_SKIP
36{
37 Q_OBJECT
38
39 public:
40 QgsElevationControllerLabels( QWidget *parent SIP_TRANSFERTHIS = nullptr );
41
42 void paintEvent( QPaintEvent *event ) override;
43
44 void setLimits( const QgsDoubleRange &limits );
45 void setRange( const QgsDoubleRange &range );
46 void setInverted( bool inverted );
47 void setSignificantElevations( const QList<double> &elevations );
48
49 private:
50 QgsDoubleRange mLimits;
51 QgsDoubleRange mRange;
52 bool mInverted = false;
53 QList<double> mSignificantElevations;
54};
55
56class GUI_EXPORT QgsElevationControllerSettingsAction : public QWidgetAction
57{
58 Q_OBJECT
59
60 public:
61 QgsElevationControllerSettingsAction( QWidget *parent = nullptr );
62
63 QgsDoubleSpinBox *sizeSpin();
64
65 private:
66 QgsDoubleSpinBox *mSizeSpin = nullptr;
67};
68
69
71
78class GUI_EXPORT QgsElevationControllerWidget : public QWidget
79{
80#ifdef SIP_RUN
82 if ( qobject_cast<QgsElevationControllerWidget *>( sipCpp ) != nullptr )
83 sipType = sipType_QgsElevationControllerWidget;
84 else
85 sipType = nullptr;
87#endif
88
89 Q_OBJECT
90
91 public:
95 QgsElevationControllerWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
96
97 void resizeEvent( QResizeEvent *event ) override;
98
105 QgsDoubleRange range() const;
106
113
118
123 QMenu *menu();
124
133 double fixedRangeSize() const;
134
135 public slots:
136
143 void setRange( const QgsDoubleRange &range );
144
150 void setRangeLimits( const QgsDoubleRange &limits );
151
161 void setFixedRangeSize( double size );
162
168 void setInverted( bool inverted );
169
173 void setSignificantElevations( const QList<double> &elevations );
174
175 signals:
176
184
191 void fixedRangeSizeChanged( double size );
192
198 void invertedChanged( bool inverted );
199
200 private:
201 void updateWidgetMask();
202
203 QToolButton *mConfigureButton = nullptr;
204 QgsElevationControllerSettingsAction *mSettingsAction = nullptr;
205 QMenu *mMenu = nullptr;
206 QAction *mInvertDirectionAction = nullptr;
207 QgsRangeSlider *mSlider = nullptr;
208 QgsElevationControllerLabels *mSliderLabels = nullptr;
209 QgsDoubleRange mRangeLimits;
210 QgsDoubleRange mCurrentRange;
211 double mFixedRangeSize = -1;
212 int mBlockSliderChanges = 0;
213 double mSliderPrecision = 100;
214};
215
216#endif // QGSELEVATIONCONTROLLERWIDGET_H
QgsRange which stores a range of double values.
Definition qgsrange.h:233
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
double fixedRangeSize() const
Returns the fixed range size, or -1 if no fixed size is set.
QgsRangeSlider * slider()
Returns a reference to the slider component of the widget.
void setSignificantElevations(const QList< double > &elevations)
Sets a list of significant elevations to highlight in the widget.
void resizeEvent(QResizeEvent *event) override
void setRange(const QgsDoubleRange &range)
Sets the current visible range for the widget.
QgsDoubleRange rangeLimits() const
Returns the limits of the elevation range which can be selected by the widget.
void setInverted(bool inverted)
Sets whether the elevation slider should be inverted.
void setFixedRangeSize(double size)
Sets the fixed range size.
void invertedChanged(bool inverted)
Emitted when the elevation filter slider is inverted.
void fixedRangeSizeChanged(double size)
Emitted when the fixed range size is changed from the widget.
void setRangeLimits(const QgsDoubleRange &limits)
Sets the limits of the elevation range which can be selected by the widget.
void rangeChanged(const QgsDoubleRange &range)
Emitted when the visible range from the widget is changed.
QgsElevationControllerWidget(QWidget *parent=nullptr)
Constructor for QgsElevationControllerWidget, with the specified parent widget.
QgsDoubleRange range() const
Returns the current visible range from the widget.
QMenu * menu()
Returns a reference to the widget's configuration menu, which can be used to add actions to the menu.
A slider control with two interactive endpoints, for interactive selection of a range of values.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:199
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_SKIP
Definition qgis_sip.h:134
#define SIP_END
Definition qgis_sip.h:216