OpendTect-6_4  6.4
i_qaction.h
Go to the documentation of this file.
1 #ifndef i_qaction_h
2 #define i_qaction_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Nanne Hemstra
9  Date: May 2007
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uiaction.h"
16 
17 #include <QObject>
18 #include <QAction>
19 #include <iostream>
20 
22 
23 QT_BEGIN_NAMESPACE
24 
25 class i_ActionMessenger : public QObject
26 {
27  Q_OBJECT
28  friend class uiAction;
29 
30 protected:
31 i_ActionMessenger( QAction* sndr, uiAction* receiver )
32  : sender_( sndr )
33  , receiver_( receiver )
34 {
35  connect( sender_, SIGNAL(toggled(bool)),this, SLOT(toggled(bool)) );
36  connect( sender_, SIGNAL(triggered(bool)), this, SLOT(triggered(bool)));
37  connect( sender_, SIGNAL(hovered()), this, SLOT(hovered()) );
38 }
39 
40 virtual ~i_ActionMessenger() {}
41 
42 private:
43 
45  QAction* sender_;
46 
47 private slots:
48 
49 void toggled( bool checked )
50 {
51  receiver_->checked_ = checked;
52  receiver_->toggled.trigger( *receiver_ );
53 }
54 
55 void triggered( bool checked )
56 {
57  const int refnr = receiver_->beginCmdRecEvent();
58  receiver_->trigger( checked );
59  receiver_->endCmdRecEvent( refnr );
60 }
61 
62 
63 void hovered()
64 {
65 }
66 
67 };
68 
69 QT_END_NAMESPACE
70 
71 #endif
uiAction * receiver_
Definition: i_qaction.h:44
void hovered()
Definition: i_qaction.h:63
void toggled(bool checked)
Definition: i_qaction.h:49
i_ActionMessenger(QAction *sndr, uiAction *receiver)
Definition: i_qaction.h:31
void triggered(bool checked)
Definition: i_qaction.h:55
QAction * sender_
Definition: i_qaction.h:45
Helper class for uiAction to relay Qt&#39;s messages.
Definition: i_qaction.h:25
virtual ~i_ActionMessenger()
Definition: i_qaction.h:40
friend class uiAction
Definition: i_qaction.h:28

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019