QGIS API Documentation  2.7.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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 : 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 
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
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...