Re: [UFO-devel] signals and slots
Status: Beta
Brought to you by:
schmidtjf
From: Johannes S. <sch...@us...> - 2005-12-01 19:06:47
|
Am Mittwoch 30 November 2005 23:05 schrieb Andreas Beckermann: > Hi > are signals/slots still supposed to work with the receiver object not being > a ufo::UObject? > I get the following error: > > ../../../ufo/include/ufo/signals/uobjectslot.hpp: In constructor > 'ufo::UObjectSlotNode::UObjectSlotNode(void (*)(void*), Obj*, void > (ufo::UObject::*)()) [with Obj = BoUfoWidget]': > ../../../ufo/include/ufo/signals/uobjectslot.hpp:177: instantiated from > 'ufo::USlot1<P1> ufo::slot(Obj&, void (Obj::*)(P1)) [with P1 = > ufo::UMouseEvent*, Obj = BoUfoWidget]' > ../../../boson/boufo/boufowidget.cpp:448: instantiated from here > ../../../ufo/include/ufo/signals/uobjectslot.hpp:90: error: invalid > static_cast from type 'BoUfoWidget*' to type 'ufo::UObject*' > ../../../boson/boufo/boufowidget.cpp: At global scope: > > Changing the static_cast into a dynamic_cast makes the compile time error > go away .. whether a runtime error is left behind is still to be tested. That should work. You may even omit the cast as this is an upcast. It seems that my compiler realized that this line of code is only executed if object is derived from UObject (due to the static template check). But indeed, some compiler may complain about that; I'll change this. Regards, Johannes |