I have released QtSignalAdapters to https://sourceforge.net/projects/qtsignaladapter/.
While not directly related to Ice, it seems that a lot of Ice fans use Qt, so I thought it might prove useful to some of you.
QtSignalAdapters makes it easy to connect a Qt signal to class methods, stand-alone functions, and function objects. The library is header only, and depends on Boost (www.boost.org).
An example will help explain what QtSignalAdapters is for. Let's say we have a slice file:
We can connect a QtPushButton directly to the move method, and a QSpinBox directory to the setMotorMoveCounts method, of a MotorControlPrx:Code:module Motors { interface MotorControl { void setMotorMoveCounts(int motorCounts); void move(); }; };
The library provides connect methods for zero to five parameters, and the parameters can be any types. See the TestQt2Func subdirectory for another example. The adapters that are created by the connectX methods are made children of the QObject (pushButton, spinBox), so that when those objects are deleted, the adapter is also deleted.Code:connect0<void()>(pushButton, SIGNAL(clicked()), boost::bind(&IceProxy::Motors::MotorControl::move, motorControlPrx_.get()); connect1<void(int)>(spinBox, SIGNAL(valueChanged(int)), boost::bind(&IceProxy::Motors::MotorControl::setMotorMoveCounts, motorControlPrx_.get(), _1));

Reply With Quote