QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
28 class GUI_EXPORT QgsMapUnitScaleDialog : public QDialog, private Ui::QgsMapUnitScaleDialog
29 {
30  Q_OBJECT
31 
32  public:
33  QgsMapUnitScaleDialog( QWidget* parent );
34 
36  QgsMapUnitScale getMapUnitScale() const;
38  void setMapUnitScale( const QgsMapUnitScale& scale );
39 
40  private slots:
41  void configureMinComboBox();
42  void configureMaxComboBox();
43 };
44 
47 class GUI_EXPORT QgsUnitSelectionWidget : public QWidget, private Ui::QgsUnitSelectionWidget
48 {
49  Q_OBJECT
50 
51  private:
52  QgsMapUnitScaleDialog* mUnitScaleDialog;
53  int mMapUnitIdx;
54 
55  public:
56  QgsUnitSelectionWidget( QWidget* parent = 0 );
57 
59  void setUnits( const QStringList& units, int mapUnitIdx );
60 
62  int getUnit() const { return mUnitCombo->currentIndex(); }
64  void setUnit( int unitIndex );
66  QgsMapUnitScale getMapUnitScale() const { return mUnitScaleDialog->getMapUnitScale(); }
68  void setMapUnitScale( const QgsMapUnitScale& scale ) { mUnitScaleDialog->setMapUnitScale( scale ); }
69 
70  signals:
71  void changed();
72 
73  private slots:
74  void showDialog();
75  void toggleUnitRangeButton();
76 };
77 
78 #endif // QGSUNITSELECTIONWIDGET_H