QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsspinbox.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsspinbox.h
3  --------------------------------------
4  Date : 09.2014
5  Copyright : (C) 2014 Denis Rouzaud
6  Email : [email protected]
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSSPPINBOX_H
17 #define QGSSPPINBOX_H
18 
19 #include <QSpinBox>
20 #include <QToolButton>
21 
25 class GUI_EXPORT QgsSpinBox : public QSpinBox
26 {
27  Q_OBJECT
28  Q_PROPERTY( bool showClearButton READ showClearButton WRITE setShowClearButton )
29 
30  public:
31  explicit QgsSpinBox( QWidget *parent = 0 );
32 
35  void setShowClearButton( const bool showClearButton );
36  bool showClearButton() const {return mShowClearButton;}
37 
39  virtual void clear();
40 
41  protected:
42  virtual void resizeEvent( QResizeEvent* event );
43  virtual void changeEvent( QEvent* event );
44 
45  private slots:
46  void changed( const int& value );
47 
48  private:
49  int frameWidth() const;
50 
51  bool mShowClearButton;
52 
53  QToolButton* mClearButton;
54 };
55 
56 #endif // QGSSPPINBOX_H