QGIS API Documentation  2.11.0-Master
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 : smani@sourcepole.ch
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 
27 class GUI_EXPORT QgsMapUnitScaleDialog : public QDialog, private Ui::QgsMapUnitScaleDialog
28 {
29  Q_OBJECT
30 
31  public:
32  QgsMapUnitScaleDialog( QWidget* parent );
33 
35  QgsMapUnitScale getMapUnitScale() const;
37  void setMapUnitScale( const QgsMapUnitScale& scale );
38 
39  private slots:
40  void configureMinComboBox();
41  void configureMaxComboBox();
42 };
43 
46 class GUI_EXPORT QgsUnitSelectionWidget : public QWidget, private Ui::QgsUnitSelectionWidget
47 {
48  Q_OBJECT
49 
50  private:
51  QgsMapUnitScaleDialog* mUnitScaleDialog;
52  int mMapUnitIdx;
53 
54  public:
55  QgsUnitSelectionWidget( QWidget* parent = 0 );
56 
61  void setUnits( const QStringList& units, int mapUnitIdx );
62 
67  void setUnits( const QgsSymbolV2::OutputUnitList& units );
68 
70  int getUnit() const { return mUnitCombo->currentIndex(); }
71 
76  QgsSymbolV2::OutputUnit unit() const;
77 
81  void setUnit( int unitIndex );
82 
86  void setUnit( QgsSymbolV2::OutputUnit unit );
87 
89  QgsMapUnitScale getMapUnitScale() const { return mUnitScaleDialog->getMapUnitScale(); }
90 
92  void setMapUnitScale( const QgsMapUnitScale& scale ) { mUnitScaleDialog->setMapUnitScale( scale ); }
93 
94  signals:
95  void changed();
96 
97  private slots:
98  void showDialog();
99  void toggleUnitRangeButton();
100 };
101 
102 #endif // QGSUNITSELECTIONWIDGET_H
QgsMapUnitScale getMapUnitScale() const
Returns the map unit scale.
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.
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...