QGIS API Documentation 3.99.0-Master (21b3aa880ba)
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:
92
96 QgsElevationControllerWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
97
98 void resizeEvent( QResizeEvent *event ) override;
99
106 QgsDoubleRange range() const;
107
114
119
124 QMenu *menu();
125
134 double fixedRangeSize() const;
135
136 public slots:
137
144 void setRange( const QgsDoubleRange &range );
145
151 void setRangeLimits( const QgsDoubleRange &limits );
152
162 void setFixedRangeSize( double size );
163
169 void setInverted( bool inverted );
170
174 void setSignificantElevations( const QList<double> &elevations );
175
176 signals:
177
185
192 void fixedRangeSizeChanged( double size );
193
199 void invertedChanged( bool inverted );
200
201 private:
202 void updateWidgetMask();
203
204 QToolButton *mConfigureButton = nullptr;
205 QgsElevationControllerSettingsAction *mSettingsAction = nullptr;
206 QMenu *mMenu = nullptr;
207 QAction *mInvertDirectionAction = nullptr;
208 QgsRangeSlider *mSlider = nullptr;
209 QgsElevationControllerLabels *mSliderLabels = nullptr;
210 QgsDoubleRange mRangeLimits;
211 QgsDoubleRange mCurrentRange;
212 double mFixedRangeSize = -1;
213 int mBlockSliderChanges = 0;
214 double mSliderPrecision = 100;
215};
216
217#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