~ubuntu-branches/ubuntu/trusty/gwenview/trusty

« back to all changes in this revision

Viewing changes to lib/binder.h

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-12-24 18:54:55 UTC
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: package-import@ubuntu.com-20111224185455-peofsmb92w3o944b
Tags: upstream-4.7.95
Import upstream version 4.7.95

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
    ~BinderInternal();
43
43
 
44
44
protected Q_SLOTS:
45
 
    virtual void callMethod() {}
 
45
    virtual void callMethod()
 
46
    {}
46
47
};
47
48
 
48
49
/**
54
55
 *
55
56
 * Assuming a class like this:
56
57
 *
57
 
 * class Receiver {
 
58
 * class Receiver
 
59
 * {
58
60
 * public:
59
61
 *   void doSomething(Param* p);
60
62
 * };
82
84
{
83
85
public:
84
86
    typedef void (Receiver::*Method)(MethodArg);
85
 
    static void bind(QObject* emitter, const char* signal, Receiver* receiver, Method method, MethodArg arg) {
 
87
    static void bind(QObject* emitter, const char* signal, Receiver* receiver, Method method, MethodArg arg)
 
88
    {
86
89
        BaseBinder<Receiver, Arg, MethodArg>* binder = new BaseBinder<Receiver, Arg, MethodArg>(emitter);
87
90
        binder->mReceiver = receiver;
88
91
        binder->mMethod = method;
92
95
    }
93
96
 
94
97
protected:
95
 
    void callMethod() {
 
98
    void callMethod()
 
99
    {
96
100
        (mReceiver->*mMethod)(mArg);
97
101
    }
98
102
 
107
111
};
108
112
 
109
113
template <class Receiver, class Arg>
110
 
class Binder : public BaseBinder<Receiver, Arg, Arg> {};
 
114
class Binder : public BaseBinder<Receiver, Arg, Arg>
 
115
{};
111
116
 
112
117
template <class Receiver, class Arg>
113
 
class BinderRef : public BaseBinder<Receiver, Arg, const Arg&> {};
 
118
class BinderRef : public BaseBinder<Receiver, Arg, const Arg&>
 
119
{};
114
120
 
115
121
} // namespace
116
122