QGIS API Documentation  2.14.0-Essen
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 
29 class GUI_EXPORT QgsMapUnitScaleDialog : public QDialog, private Ui::QgsMapUnitScaleDialog
30 {
31  Q_OBJECT
32 
33  public:
34  QgsMapUnitScaleDialog( QWidget* parent = nullptr );
35 
37  QgsMapUnitScale getMapUnitScale() const;
39  void setMapUnitScale( const QgsMapUnitScale& scale );
40 
46  void setMapCanvas( QgsMapCanvas* canvas );
47 
48  private slots:
49  void configureMinComboBox();
50  void configureMaxComboBox();
51 
52 };
53 
56 class GUI_EXPORT QgsUnitSelectionWidget : public QWidget, private Ui::QgsUnitSelectionWidget
57 {
58  Q_OBJECT
59 
60  private:
61  QgsMapUnitScaleDialog* mUnitScaleDialog;
62  int mMapUnitIdx;
63 
64  public:
65  QgsUnitSelectionWidget( QWidget* parent = nullptr );
66 
71  void setUnits( const QStringList& units, int mapUnitIdx );
72 
77  void setUnits( const QgsSymbolV2::OutputUnitList& units );
78 
80  int getUnit() const { return mUnitCombo->currentIndex(); }
81 
86  QgsSymbolV2::OutputUnit unit() const;
87 
92  void setUnit( int unitIndex );
93 
97  void setUnit( QgsSymbolV2::OutputUnit unit );
98 
100  QgsMapUnitScale getMapUnitScale() const { return mUnitScaleDialog->getMapUnitScale(); }
101 
103  void setMapUnitScale( const QgsMapUnitScale& scale ) { mUnitScaleDialog->setMapUnitScale( scale ); }
104 
110  void setMapCanvas( QgsMapCanvas* canvas );
111 
112  signals:
113  void changed();
114 
115  private slots:
116  void showDialog();
117  void toggleUnitRangeButton();
118 
119 };
120 
121 #endif // QGSUNITSELECTIONWIDGET_H
OutputUnit
The unit of the output.
Definition: qgssymbolv2.h:62
QgsMapUnitScale getMapUnitScale() const
Returns the map unit scale.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:105
int getUnit() const
Get the selected unit index.
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.
Struct for storing maximum and minimum scales for measurements in map units.
QgsMapUnitScale getMapUnitScale() const
Returns the map unit scale.
Widget displaying a combobox allowing the user to choose between millimeter and map units If the user...