QGIS API Documentation  2.6.0-Brighton
 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  QString scaleString();
37  bool setScaleString( QString scaleTxt );
39  double scale();
41  void setScale( double scale );
42 
44  // Performs rounding, so an exact representation is not to
45  // be expected.
46  static QString toString( double scale );
48  static double toDouble( QString scaleString, bool *ok = NULL );
49 
50  signals:
52  void scaleChanged();
53 
54  public slots:
55  void updateScales( const QStringList &scales = QStringList() );
56 
57  protected:
58  void showPopup();
59 
60  private slots:
61  void fixupScale();
62 
63  private:
64  double mScale;
65 };
66 
67 #endif // QGSSCALECOMBOBOX_H