QGIS API Documentation  2.2.0-Valmiera
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsscalecombobox.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsscalecombobox.h
3  ------------------------
4  begin : January 7, 2012
5  copyright : (C) 2012 by Alexander Bruy
6  email : alexander dot bruy at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSSCALECOMBOBOX_H
19 #define QGSSCALECOMBOBOX_H
20 
21 #include <QComboBox>
22 
27 class GUI_EXPORT QgsScaleComboBox : public QComboBox
28 {
29  Q_OBJECT
30  public:
31  QgsScaleComboBox( QWidget* parent = 0 );
32  virtual ~QgsScaleComboBox();
33 
35  // @note added in 2.0
36  QString scaleString();
38  // @note added in 2.0
39  bool setScaleString( QString scaleTxt );
41  // @note added in 2.0
42  double scale();
44  // @note added in 2.0
45  void setScale( double scale );
46 
48  // Performs rounding, so an exact representation is not to
49  // be expected.
50  // @note added in 2.0
51  static QString toString( double scale );
53  // @note added in 2.0
54  static double toDouble( QString scaleString, bool *ok = NULL );
55 
56  signals:
58  // @note added in 2.0
59  void scaleChanged();
60 
61  public slots:
62  void updateScales( const QStringList &scales = QStringList() );
63 
64  protected:
65  void showPopup();
66 
67  private slots:
68  void fixupScale();
69 
70  private:
71  double mScale;
72 };
73 
74 #endif // QGSSCALECOMBOBOX_H