QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgsunitselectionwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsunitselectionwidget.h
3  -------------------
4  begin : Mar 24, 2014
5  copyright : (C) 2014 Sandro Mani
6  email : [email protected]
7 
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 #ifndef QGSUNITSELECTIONWIDGET_H
19 #define QGSUNITSELECTIONWIDGET_H
20 
21 #include <QWidget>
22 #include "qgssymbolv2.h"
23 #include "ui_qgsunitselectionwidget.h"
24 #include "ui_qgsmapunitscaledialog.h"
25 
26 class QgsMapCanvas;
27 
30 class GUI_EXPORT QgsMapUnitScaleDialog : public QDialog, private Ui::QgsMapUnitScaleDialog
31 {
32  Q_OBJECT
33 
34  public:
35  QgsMapUnitScaleDialog( QWidget* parent = nullptr );
36 
38  QgsMapUnitScale getMapUnitScale() const;
40  void setMapUnitScale( const QgsMapUnitScale& scale );
41 
47  void setMapCanvas( QgsMapCanvas* canvas );
48 
49  private slots:
50  void configureMinComboBox();
51  void configureMaxComboBox();
52 
53 };
54 
58 class GUI_EXPORT QgsUnitSelectionWidget : public QWidget, private Ui::QgsUnitSelectionWidget
59 {
60  Q_OBJECT
61 
62  private:
63  QgsMapUnitScaleDialog* mUnitScaleDialog;
64  int mMapUnitIdx;
65 
66  public:
67  QgsUnitSelectionWidget( QWidget* parent = nullptr );
68 
73  void setUnits( const QStringList& units, int mapUnitIdx );
74 
79  void setUnits( const QgsSymbolV2::OutputUnitList& units );
80 
82  int getUnit() const { return mUnitCombo->currentIndex(); }
83 
88  QgsSymbolV2::OutputUnit unit() const;
89 
94  void setUnit( int unitIndex );
95 
99  void setUnit( QgsSymbolV2::OutputUnit unit );
100 
102  QgsMapUnitScale getMapUnitScale() const { return mUnitScaleDialog->getMapUnitScale(); }
103 
105  void setMapUnitScale( const QgsMapUnitScale& scale ) { mUnitScaleDialog->setMapUnitScale( scale ); }
106 
112  void setMapCanvas( QgsMapCanvas* canvas );
113 
114  signals:
115  void changed();
116 
117  private slots:
118  void showDialog();
119  void toggleUnitRangeButton();
120 
121 };
122 
123 #endif // QGSUNITSELECTIONWIDGET_H
OutputUnit
The unit of the output.
Definition: qgssymbolv2.h:65
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:109
QgsMapUnitScale getMapUnitScale() const
Returns the map unit scale.
void setMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale.
Dialog allowing the user to choose the minimum and maximum scale of an object in map units...
void setMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale.
QgsMapUnitScale getMapUnitScale() const
Returns the map unit scale.
Struct for storing maximum and minimum scales for measurements in map units.
int getUnit() const
Get the selected unit index.
Widget displaying a combobox allowing the user to choose between millimeter and map units If the user...