OpenWalnut  1.5.0dev
WQtPushButton.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WQTPUSHBUTTON_H
26 #define WQTPUSHBUTTON_H
27 
28 #include <string>
29 
30 #include <QPushButton>
31 #include <QToolButton>
32 
33 /**
34  * Implements a QPushButton with a boost signal for convenience.
35  */
36 class WQtPushButton : public QToolButton
37 {
38  Q_OBJECT
39 
40 public:
41  /**
42  * standard constructor
43  * \param icon The icon being displayed on the button.
44  * \param name a name for the button. This name is sometimes used to identify signals.
45  * \param parent the widget that takes care of the current widget.
46  * \param label The optional label that will be displayed besides the icon.
47  */
48  explicit WQtPushButton( QIcon icon, QString name, QWidget* parent = 0, QString label = "" );
49 
50  /**
51  * destructor
52  */
53  virtual ~WQtPushButton();
54 
55  /**
56  * Setter for name.
57  *
58  * \param name The new name of the button
59  */
60  void setName( QString name );
61 
62  /**
63  * Getter for this button's name.
64  *
65  * \return the name
66  */
67  QString getName();
68 
69 private:
70  QString m_name; //!< name of the push button
71 
72 public slots:
73 
74  /**
75  * Slot getting called when the button got pressed.
76  */
77  void emitPressed();
78 
79 signals:
80 
81  /**
82  * Signal whenever the button got pressed.
83  *
84  * \param name the name of the button.
85  */
86  void pushButtonPressed( QString name );
87 };
88 
89 #endif // WQTPUSHBUTTON_H
Implements a QPushButton with a boost signal for convenience.
Definition: WQtPushButton.h:37
WQtPushButton(QIcon icon, QString name, QWidget *parent=0, QString label="")
standard constructor
QString getName()
Getter for this button's name.
QString m_name
name of the push button
Definition: WQtPushButton.h:70
void pushButtonPressed(QString name)
Signal whenever the button got pressed.
virtual ~WQtPushButton()
destructor
void setName(QString name)
Setter for name.
void emitPressed()
Slot getting called when the button got pressed.