Mapping Subscribe slots for use in layout?
Posted: Sat Dec 31, 2011 12:44
So I'm a bit new at this, so correct me if I'm wrong.
AFAIK, when you define a window in a layout XML and load it, you gotta fetch that window by name in c++ to attach a subscriber slot for an event.
So if I chose to remove or rename a window in the layout file it will throw an exception when trying to access the window by name in the c++ code. Kind of defeats part of the purpose of using the layout file..
Is there a way to make these bindings more dynamic? I'd like to register the SubscriberSlots somewhere and then link them by declaring the event and slot in the layout file, not in the c++ code.
If there's no system in place to do this already, I'd like to suggest it! ( Should I post it in another forum in that case? )
AFAIK, when you define a window in a layout XML and load it, you gotta fetch that window by name in c++ to attach a subscriber slot for an event.
Code: Select all
Window* win = static_cast<Window*>( windowmgr.getWindow( "myWindow" ) );
win->subscribeEvent( Window::EventClicked, SubscriberSlot( &handler, obj) );
So if I chose to remove or rename a window in the layout file it will throw an exception when trying to access the window by name in the c++ code. Kind of defeats part of the purpose of using the layout file..
Is there a way to make these bindings more dynamic? I'd like to register the SubscriberSlots somewhere and then link them by declaring the event and slot in the layout file, not in the c++ code.
If there's no system in place to do this already, I'd like to suggest it! ( Should I post it in another forum in that case? )