OpenWalnut  1.5.0dev
WQtPropertyBoolAction.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 WQTPROPERTYBOOLACTION_H
26 #define WQTPROPERTYBOOLACTION_H
27 
28 #include <QAction>
29 
30 #include "core/common/WPropertyVariable.h"
31 
32 /**
33  * Implements a property action for WPropBool.
34  */
36 {
37  Q_OBJECT
38 public:
39  /**
40  * Constructor. Creates a new action appropriate for the specified property.
41  *
42  * \param property the property to handle
43  * \param parent the parent widget.
44  */
45  WQtPropertyBoolAction( WPropBool property, QWidget* parent = 0 );
46 
47  /**
48  * Destructor.
49  */
50  virtual ~WQtPropertyBoolAction();
51 
52 protected:
53  /**
54  * Called whenever the widget should update.
55  */
56  virtual void update();
57 
58  /**
59  * The boolean property represented by this widget.
60  */
61  WPropBool m_boolProperty;
62 
63 
64  /**
65  * Callback for WPropertyBase::getChangeCondition. It emits an event to ensure all updates are done in gui thread.
66  */
67  virtual void propertyChangeNotifier();
68 
69  /**
70  * Custom event dispatcher. Gets called by QT's Event system every time an event got sent to this widget. This event handler
71  * processes property change events.
72  *
73  * \note QT Doc says: use event() for custom events.
74  * \param event the event that got transmitted.
75  *
76  * \return true if the event got handled properly.
77  */
78  virtual bool event( QEvent* event );
79 
80  /**
81  * The connection for propertyChangeNotifier().
82  */
83  boost::signals2::connection m_connection;
84 
85 private:
86 public slots:
87 
88  /**
89  * called whenever the user modifies the action
90  */
91  void changed();
92 };
93 
94 #endif // WQTPROPERTYBOOLACTION_H
95 
Implements a property action for WPropBool.
WPropBool m_boolProperty
The boolean property represented by this widget.
virtual bool event(QEvent *event)
Custom event dispatcher.
virtual ~WQtPropertyBoolAction()
Destructor.
WQtPropertyBoolAction(WPropBool property, QWidget *parent=0)
Constructor.
void changed()
called whenever the user modifies the action
virtual void propertyChangeNotifier()
Callback for WPropertyBase::getChangeCondition.
boost::signals2::connection m_connection
The connection for propertyChangeNotifier().
virtual void update()
Called whenever the widget should update.