48 #ifndef _MIRA_SIGNALBINDER_H_ 49 #define _MIRA_SIGNALBINDER_H_ 52 #include <boost/function.hpp> 97 void bind(boost::function<
void()> f) { mVoid = f; }
100 void bindInt(boost::function<
void(
int)> f) { mInt = f; }
103 void bindQString(boost::function<
void(
const QString&)> f) { mQString = f; }
107 void slot() {
if(mVoid) mVoid(); }
108 void slot(
int val) {
if(mInt) mInt(val); }
109 void slot(
const QString& val) {
if(mQString) mQString(val); }
120 boost::function<
void()>
function)
123 binder->
bind(
function);
124 binder->QObject::connect(sender,signal, binder, SLOT(slot()));
133 template<
typename Class>
136 return connect(sender,signal,(boost::function<
void()>)boost::bind(method, instance));
145 boost::function<
void(
int)>
function)
149 binder->QObject::connect(sender,signal, binder, SLOT(slot(
int)));
158 template<
typename Class>
160 void (
Class::*method)(
int),
Class* instance) {
161 return connect(sender,signal,(boost::function<
void(
int)>)boost::bind(method, instance, _1));
170 boost::function<
void(
const QString&)>
function)
174 binder->QObject::connect(sender,signal, binder, SLOT(slot(
const QString&)));
183 template<
typename Class>
185 void (
Class::*method)(
const QString&),
Class* instance) {
186 return connect(sender,signal,(boost::function<
void(
const QString&)>)boost::bind(method, instance, _1));
191 boost::function<void()> mVoid;
192 boost::function<void(int)> mInt;
193 boost::function<void(const QString&)> mQString;
static SignalBinder * connect(QObject *sender, const char *signal, void(Class::*method)(const QString &), Class *instance)
Create a SignalBinder instance and binds the specified 'signal' of the 'sender' to the specified 'met...
Definition: SignalBinder.h:184
Class that provides different slots with different parameters.
Definition: SignalBinder.h:87
static SignalBinder * connect(QObject *sender, const char *signal, boost::function< void(int)> function)
Create a SignalBinder instance and binds the specified 'signal' of the 'sender' to the specified func...
Definition: SignalBinder.h:144
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
SignalBinder(QObject *parent)
Definition: SignalBinder.h:91
Class object which supports some kind of class reflection.
Definition: Class.h:97
void slot()
Definition: SignalBinder.h:107
void bindQString(boost::function< void(const QString &)> f)
binds the given function to the slot "slot(const QString&)"
Definition: SignalBinder.h:103
void bindInt(boost::function< void(int)> f)
binds the given function to the slot "slot(int)"
Definition: SignalBinder.h:100
void slot(int val)
Definition: SignalBinder.h:108
static SignalBinder * connect(QObject *sender, const char *signal, boost::function< void()> function)
Create a SignalBinder instance and binds the specified 'signal' of the 'sender' to the specified func...
Definition: SignalBinder.h:119
void slot(const QString &val)
Definition: SignalBinder.h:109
static SignalBinder * connect(QObject *sender, const char *signal, boost::function< void(const QString &)> function)
Create a SignalBinder instance and binds the specified 'signal' of the 'sender' to the specified func...
Definition: SignalBinder.h:169
void bind(boost::function< void()> f)
binds the given function to the slot "slot()"
Definition: SignalBinder.h:97
static SignalBinder * connect(QObject *sender, const char *signal, void(Class::*method)(int), Class *instance)
Create a SignalBinder instance and binds the specified 'signal' of the 'sender' to the specified 'met...
Definition: SignalBinder.h:159
static SignalBinder * connect(QObject *sender, const char *signal, void(Class::*method)(), Class *instance)
Create a SignalBinder instance and binds the specified 'signal' of the 'sender' to the specified 'met...
Definition: SignalBinder.h:134