48 #ifndef _MIRA_SIGNALBINDER_H_ 49 #define _MIRA_SIGNALBINDER_H_ 52 #include <boost/function.hpp> 95 void bind(boost::function<
void()> f) { mVoid = f; }
98 void bindInt(boost::function<
void(
int)> f) { mInt = f; }
101 void bindQString(boost::function<
void(
const QString&)> f) { mQString = f; }
105 void slot() {
if(mVoid) mVoid(); }
106 void slot(
int val) {
if(mInt) mInt(val); }
107 void slot(
const QString& val) {
if(mQString) mQString(val); }
118 boost::function<
void()>
function)
121 binder->
bind(
function);
122 binder->QObject::connect(sender,signal, binder, SLOT(
slot()));
131 template<
typename Class>
134 return connect(sender,signal,(boost::function<
void()>)boost::bind(method, instance));
143 boost::function<
void(
int)>
function)
147 binder->QObject::connect(sender,signal, binder, SLOT(
slot(
int)));
156 template<
typename Class>
158 void (
Class::*method)(
int),
Class* instance) {
159 return connect(sender,signal,(boost::function<
void(
int)>)boost::bind(method, instance, _1));
168 boost::function<
void(
const QString&)>
function)
172 binder->QObject::connect(sender,signal, binder, SLOT(
slot(
const QString&)));
181 template<
typename Class>
183 void (
Class::*method)(
const QString&),
Class* instance) {
184 return connect(sender,signal,(boost::function<
void(
const QString&)>)boost::bind(method, instance, _1));
189 boost::function<void()> mVoid;
190 boost::function<void(int)> mInt;
191 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:182
Class that provides different slots with different parameters.
Definition: SignalBinder.h:85
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:142
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
SignalBinder(QObject *parent)
Definition: SignalBinder.h:89
Class object which supports some kind of class reflection.
Definition: Class.h:97
void slot()
Definition: SignalBinder.h:105
void bindQString(boost::function< void(const QString &)> f)
binds the given function to the slot "slot(const QString&)"
Definition: SignalBinder.h:101
void bindInt(boost::function< void(int)> f)
binds the given function to the slot "slot(int)"
Definition: SignalBinder.h:98
void slot(int val)
Definition: SignalBinder.h:106
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:117
void slot(const QString &val)
Definition: SignalBinder.h:107
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:167
void bind(boost::function< void()> f)
binds the given function to the slot "slot()"
Definition: SignalBinder.h:95
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:157
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:132